student_mvp 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/doc/App_logger.html +47 -33
  3. data/doc/DB_client.html +20 -10
  4. data/doc/created.rid +10 -44
  5. data/doc/index.html +2 -81
  6. data/doc/js/search_index.js +1 -1
  7. data/doc/js/search_index.js.gz +0 -0
  8. data/doc/table_of_contents.html +9 -697
  9. data/lib/data_access/DB_client/DB_client.rb +20 -1
  10. data/lib/logger/logger.rb +35 -0
  11. data/lib/presenters/base_presenters/student_list_presenter.rb +1 -1
  12. data/lib/student_mvp/version.rb +1 -1
  13. metadata +56 -35
  14. data/doc/Binary_tree.html +0 -300
  15. data/doc/Binary_tree_iterator.html +0 -217
  16. data/doc/Contact_sort_decorator.html +0 -219
  17. data/doc/Data_list.html +0 -625
  18. data/doc/Data_list_student_short.html +0 -148
  19. data/doc/Data_storage_strategy.html +0 -178
  20. data/doc/Data_table.html +0 -264
  21. data/doc/Deep_dup.html +0 -152
  22. data/doc/Field_filter_decorator.html +0 -219
  23. data/doc/Filter.html +0 -148
  24. data/doc/Filter_decorator.html +0 -209
  25. data/doc/Full_name_filter_decorator.html +0 -211
  26. data/doc/Full_name_sort_decorator.html +0 -217
  27. data/doc/Gemfile.html +0 -98
  28. data/doc/Git_sort_decorator.html +0 -220
  29. data/doc/Has_not_field_filter_decorator.html +0 -209
  30. data/doc/JSON_storage_strategy.html +0 -183
  31. data/doc/Person.html +0 -511
  32. data/doc/README_md.html +0 -147
  33. data/doc/Rakefile.html +0 -94
  34. data/doc/Sort_decorator.html +0 -214
  35. data/doc/Student.html +0 -755
  36. data/doc/StudentMvp/Error.html +0 -105
  37. data/doc/StudentMvp.html +0 -111
  38. data/doc/Student_short.html +0 -398
  39. data/doc/Students_list.html +0 -341
  40. data/doc/Students_list_DB.html +0 -361
  41. data/doc/Students_list_file.html +0 -460
  42. data/doc/Students_list_file_adapter.html +0 -341
  43. data/doc/Students_list_interface.html +0 -298
  44. data/doc/YAML_storage_strategy.html +0 -183
  45. data/doc/bin/setup.html +0 -96
@@ -1,361 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
-
8
- <title>class Students_list_DB - RDoc Documentation</title>
9
-
10
- <meta name="keywords" content="ruby,class,Students_list_DB">
11
-
12
- <meta name="description" content="Documentation for the Students_list_DB class">
13
-
14
- <script type="text/javascript">
15
- var rdoc_rel_prefix = "./";
16
- var index_rel_prefix = "./";
17
- </script>
18
-
19
- <script src="./js/navigation.js" defer></script>
20
- <script src="./js/search.js" defer></script>
21
- <script src="./js/search_index.js" defer></script>
22
- <script src="./js/searcher.js" defer></script>
23
- <script src="./js/darkfish.js" defer></script>
24
-
25
- <link href="./css/fonts.css" rel="stylesheet">
26
- <link href="./css/rdoc.css" rel="stylesheet">
27
-
28
-
29
- <body id="top" role="document" class="class">
30
- <div id="navigation-toggle" role="button" tabindex="0" aria-label="Toggle sidebar" aria-expanded="true" aria-controls="navigation">
31
- <span aria-hidden="true">&#9776;</span>
32
- </div>
33
-
34
-
35
- <nav id="navigation" role="navigation">
36
- <div id="project-navigation">
37
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
38
- <h2>
39
- <a href="./index.html" rel="home">Home</a>
40
- </h2>
41
-
42
- <div id="table-of-contents-navigation">
43
- <a href="./table_of_contents.html#pages">Pages</a>
44
- <a href="./table_of_contents.html#classes">Classes</a>
45
- <a href="./table_of_contents.html#methods">Methods</a>
46
- </div>
47
- </div>
48
-
49
- <div id="search-section" role="search" class="project-section initially-hidden">
50
- <form action="#" method="get" accept-charset="utf-8">
51
- <div id="search-field-wrapper">
52
- <input id="search-field" role="combobox" aria-label="Search"
53
- aria-autocomplete="list" aria-controls="search-results"
54
- type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
55
- title="Type to search, Up and Down to navigate, Enter to load">
56
- </div>
57
-
58
- <ul id="search-results" aria-label="Search Results"
59
- aria-busy="false" aria-expanded="false"
60
- aria-atomic="false" class="initially-hidden"></ul>
61
- </form>
62
- </div>
63
-
64
- </div>
65
-
66
-
67
-
68
- <div id="parent-class-section" class="nav-section">
69
- <h3>Ancestors</h3>
70
- <ul><li><a href="Students_list_interface.html">Students_list_interface</a><ul><li>Object</li></ul></li></ul>
71
- </div>
72
-
73
-
74
-
75
-
76
-
77
-
78
- <div class="nav-section">
79
- <h3>Instance Methods</h3>
80
- <ul class="link-list" role="directory">
81
- <li ><a href="#method-i-add_student">add_student</a></li>
82
- <li ><a href="#method-i-delete_student">delete_student</a></li>
83
- <li ><a href="#method-i-get_k_n_student_short_list">get_k_n_student_short_list</a></li>
84
- <li ><a href="#method-i-get_student_by_id">get_student_by_id</a></li>
85
- <li ><a href="#method-i-get_student_short_count">get_student_short_count</a></li>
86
- <li ><a href="#method-i-replace_student">replace_student</a></li>
87
- </ul>
88
- </div>
89
-
90
-
91
-
92
- <footer id="validator-badges" role="contentinfo">
93
- <p><a href="https://validator.w3.org/check/referer">Validate</a>
94
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.8.1.
95
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
96
- </footer>
97
-
98
- </nav>
99
-
100
- <main role="main" aria-labelledby="class-Students_list_DB">
101
- <h1 id="class-Students_list_DB" class="anchor-link class">
102
- class Students_list_DB
103
- </h1>
104
-
105
- <section class="description">
106
-
107
- </section>
108
-
109
- <section id="5Buntitled-5D" class="documentation-section anchor-link">
110
-
111
-
112
-
113
-
114
-
115
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section anchor-link">
116
- <header>
117
- <h3>Public Instance Methods</h3>
118
- </header>
119
-
120
- <div id="method-i-add_student" class="method-detail anchor-link ">
121
- <div class="method-header">
122
- <div class="method-heading">
123
- <a href="#method-i-add_student" title="Link to this method">
124
- <span class="method-name">add_student</span>
125
- <span class="method-args">(student)</span>
126
- </a>
127
- </div>
128
- </div>
129
-
130
- <div class="method-controls">
131
- <details class="method-source-toggle">
132
- <summary>Source</summary>
133
- </details>
134
- </div>
135
-
136
- <div class="method-description">
137
- <div class="method-source-code" id="add_student-source">
138
- <pre><span class="ruby-comment"># File lib/models/students_list/students_list_DB.rb, line 30</span>
139
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_student</span>(<span class="ruby-identifier">student</span>)
140
- <span class="ruby-identifier">query</span> = <span class="ruby-identifier">&lt;&lt;-SQL</span>
141
- <span class="ruby-value"> INSERT INTO student (first_name, name, patronymic, birthdate, telegram, email, phone_number, git)
142
- VALUES (?, ?, ?, ?, ?, ?, ?, ?)
143
- </span><span class="ruby-identifier"> SQL</span>
144
-
145
- <span class="ruby-keyword">begin</span>
146
- <span class="ruby-constant">DB_client</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">query</span>(<span class="ruby-identifier">query</span>, [
147
- <span class="ruby-identifier">student</span>.<span class="ruby-identifier">first_name</span>,
148
- <span class="ruby-identifier">student</span>.<span class="ruby-identifier">name</span>,
149
- <span class="ruby-identifier">student</span>.<span class="ruby-identifier">patronymic</span>,
150
- <span class="ruby-identifier">student</span>.<span class="ruby-identifier">birthdate</span>,
151
- <span class="ruby-identifier">student</span>.<span class="ruby-identifier">telegram</span>,
152
- <span class="ruby-identifier">student</span>.<span class="ruby-identifier">email</span>,
153
- <span class="ruby-identifier">student</span>.<span class="ruby-identifier">phone_number</span>,
154
- <span class="ruby-identifier">student</span>.<span class="ruby-identifier">git</span>
155
- ])
156
- <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Mysql2</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
157
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&#39;Duplicate entry&#39;</span>)
158
- <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Student with this unique value already exists - #{e.message}&quot;</span>
159
- <span class="ruby-keyword">else</span>
160
- <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
161
- <span class="ruby-keyword">end</span>
162
- <span class="ruby-keyword">end</span>
163
- <span class="ruby-keyword">end</span></pre>
164
- </div>
165
-
166
- </div>
167
-
168
-
169
- </div>
170
-
171
- <div id="method-i-delete_student" class="method-detail anchor-link ">
172
- <div class="method-header">
173
- <div class="method-heading">
174
- <a href="#method-i-delete_student" title="Link to this method">
175
- <span class="method-name">delete_student</span>
176
- <span class="method-args">(id)</span>
177
- </a>
178
- </div>
179
- </div>
180
-
181
- <div class="method-controls">
182
- <details class="method-source-toggle">
183
- <summary>Source</summary>
184
- </details>
185
- </div>
186
-
187
- <div class="method-description">
188
- <div class="method-source-code" id="delete_student-source">
189
- <pre><span class="ruby-comment"># File lib/models/students_list/students_list_DB.rb, line 83</span>
190
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_student</span>(<span class="ruby-identifier">id</span>)
191
- <span class="ruby-identifier">query</span> = <span class="ruby-string">&quot;DELETE FROM student WHERE id = ?&quot;</span>
192
- <span class="ruby-constant">DB_client</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">query</span>(<span class="ruby-identifier">query</span>, [<span class="ruby-identifier">id</span>])
193
- <span class="ruby-keyword">end</span></pre>
194
- </div>
195
-
196
- </div>
197
-
198
-
199
- </div>
200
-
201
- <div id="method-i-get_k_n_student_short_list" class="method-detail anchor-link ">
202
- <div class="method-header">
203
- <div class="method-heading">
204
- <a href="#method-i-get_k_n_student_short_list" title="Link to this method">
205
- <span class="method-name">get_k_n_student_short_list</span>
206
- <span class="method-args">(k, n, filter = nil, data_list = nil)</span>
207
- </a>
208
- </div>
209
- </div>
210
-
211
- <div class="method-controls">
212
- <details class="method-source-toggle">
213
- <summary>Source</summary>
214
- </details>
215
- </div>
216
-
217
- <div class="method-description">
218
- <div class="method-source-code" id="get_k_n_student_short_list-source">
219
- <pre><span class="ruby-comment"># File lib/models/students_list/students_list_DB.rb, line 17</span>
220
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_k_n_student_short_list</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">n</span>, <span class="ruby-identifier">filter</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">data_list</span> = <span class="ruby-keyword">nil</span>)
221
- <span class="ruby-identifier">base_query</span> = <span class="ruby-string">&quot;SELECT * FROM student&quot;</span>
222
- <span class="ruby-identifier">filter_query</span> = <span class="ruby-identifier">filter</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">apply</span>(<span class="ruby-identifier">base_query</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">base_query</span>
223
- <span class="ruby-identifier">start</span> = (<span class="ruby-identifier">k</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>
224
-
225
- <span class="ruby-identifier">result</span> = <span class="ruby-constant">DB_client</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">query</span>(<span class="ruby-identifier">filter_query</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot; LIMIT ? OFFSET ?&quot;</span>, [<span class="ruby-identifier">n</span>, <span class="ruby-identifier">start</span>])
226
- <span class="ruby-identifier">students_short</span> = <span class="ruby-identifier">result</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">row</span><span class="ruby-operator">|</span> <span class="ruby-constant">Student_short</span>.<span class="ruby-identifier">new_from_student_obj</span>(<span class="ruby-constant">Student</span>.<span class="ruby-identifier">new_from_hash</span>(<span class="ruby-identifier">row</span>)) }
227
- <span class="ruby-identifier">data_list</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Data_list_student_short</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">students_short</span>)
228
- <span class="ruby-identifier">data_list</span>.<span class="ruby-identifier">index</span> = <span class="ruby-identifier">start</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
229
- <span class="ruby-identifier">data_list</span>.<span class="ruby-identifier">data</span> = <span class="ruby-identifier">students_short</span>
230
- <span class="ruby-identifier">data_list</span>
231
- <span class="ruby-keyword">end</span></pre>
232
- </div>
233
-
234
- </div>
235
-
236
-
237
- </div>
238
-
239
- <div id="method-i-get_student_by_id" class="method-detail anchor-link ">
240
- <div class="method-header">
241
- <div class="method-heading">
242
- <a href="#method-i-get_student_by_id" title="Link to this method">
243
- <span class="method-name">get_student_by_id</span>
244
- <span class="method-args">(id)</span>
245
- </a>
246
- </div>
247
- </div>
248
-
249
- <div class="method-controls">
250
- <details class="method-source-toggle">
251
- <summary>Source</summary>
252
- </details>
253
- </div>
254
-
255
- <div class="method-description">
256
- <div class="method-source-code" id="get_student_by_id-source">
257
- <pre><span class="ruby-comment"># File lib/models/students_list/students_list_DB.rb, line 9</span>
258
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_student_by_id</span>(<span class="ruby-identifier">id</span>)
259
- <span class="ruby-identifier">result</span> = <span class="ruby-constant">DB_client</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">query</span>(<span class="ruby-string">&quot;SELECT * FROM student WHERE id = ?&quot;</span>, [<span class="ruby-identifier">id</span>])
260
- <span class="ruby-identifier">row</span> = <span class="ruby-identifier">result</span>.<span class="ruby-identifier">first</span>
261
- <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">row</span>
262
-
263
- <span class="ruby-constant">Student</span>.<span class="ruby-identifier">new_from_hash</span>(<span class="ruby-identifier">row</span>)
264
- <span class="ruby-keyword">end</span></pre>
265
- </div>
266
-
267
- </div>
268
-
269
-
270
- </div>
271
-
272
- <div id="method-i-get_student_short_count" class="method-detail anchor-link ">
273
- <div class="method-header">
274
- <div class="method-heading">
275
- <a href="#method-i-get_student_short_count" title="Link to this method">
276
- <span class="method-name">get_student_short_count</span>
277
- <span class="method-args">(filter = nil)</span>
278
- </a>
279
- </div>
280
- </div>
281
-
282
- <div class="method-controls">
283
- <details class="method-source-toggle">
284
- <summary>Source</summary>
285
- </details>
286
- </div>
287
-
288
- <div class="method-description">
289
- <div class="method-source-code" id="get_student_short_count-source">
290
- <pre><span class="ruby-comment"># File lib/models/students_list/students_list_DB.rb, line 88</span>
291
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_student_short_count</span>(<span class="ruby-identifier">filter</span> = <span class="ruby-keyword">nil</span>)
292
- <span class="ruby-identifier">base_query</span> = <span class="ruby-string">&quot;SELECT COUNT(*) AS count FROM student&quot;</span>
293
- <span class="ruby-identifier">filter_query</span> = <span class="ruby-identifier">filter</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">apply</span>(<span class="ruby-identifier">base_query</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">base_query</span>
294
-
295
- <span class="ruby-identifier">result</span> = <span class="ruby-constant">DB_client</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">query</span>(<span class="ruby-identifier">filter_query</span>)
296
- <span class="ruby-identifier">result</span>.<span class="ruby-identifier">first</span>[<span class="ruby-string">&#39;count&#39;</span>]
297
- <span class="ruby-keyword">end</span></pre>
298
- </div>
299
-
300
- </div>
301
-
302
-
303
- </div>
304
-
305
- <div id="method-i-replace_student" class="method-detail anchor-link ">
306
- <div class="method-header">
307
- <div class="method-heading">
308
- <a href="#method-i-replace_student" title="Link to this method">
309
- <span class="method-name">replace_student</span>
310
- <span class="method-args">(id, new_student)</span>
311
- </a>
312
- </div>
313
- </div>
314
-
315
- <div class="method-controls">
316
- <details class="method-source-toggle">
317
- <summary>Source</summary>
318
- </details>
319
- </div>
320
-
321
- <div class="method-description">
322
- <div class="method-source-code" id="replace_student-source">
323
- <pre><span class="ruby-comment"># File lib/models/students_list/students_list_DB.rb, line 56</span>
324
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">replace_student</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">new_student</span>)
325
- <span class="ruby-identifier">query</span> = <span class="ruby-identifier">&lt;&lt;-SQL</span>
326
- <span class="ruby-value"> UPDATE student
327
- SET first_name = ?, name = ?, patronymic = ?, birthdate = ?, telegram = ?, email = ?, phone_number = ?, git = ?
328
- WHERE id = ?
329
- </span><span class="ruby-identifier"> SQL</span>
330
- <span class="ruby-keyword">begin</span>
331
- <span class="ruby-constant">DB_client</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">query</span>(<span class="ruby-identifier">query</span>, [
332
- <span class="ruby-identifier">new_student</span>.<span class="ruby-identifier">first_name</span>,
333
- <span class="ruby-identifier">new_student</span>.<span class="ruby-identifier">name</span>,
334
- <span class="ruby-identifier">new_student</span>.<span class="ruby-identifier">patronymic</span>,
335
- <span class="ruby-identifier">new_student</span>.<span class="ruby-identifier">birthdate</span>,
336
- <span class="ruby-identifier">new_student</span>.<span class="ruby-identifier">telegram</span>,
337
- <span class="ruby-identifier">new_student</span>.<span class="ruby-identifier">email</span>,
338
- <span class="ruby-identifier">new_student</span>.<span class="ruby-identifier">phone_number</span>,
339
- <span class="ruby-identifier">new_student</span>.<span class="ruby-identifier">git</span>,
340
- <span class="ruby-identifier">id</span>
341
- ])
342
- <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Mysql2</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
343
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&#39;Duplicate entry&#39;</span>)
344
- <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Error: Student with this unique value already exists - #{e.message}&quot;</span>
345
- <span class="ruby-keyword">else</span>
346
- <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
347
- <span class="ruby-keyword">end</span>
348
- <span class="ruby-keyword">end</span>
349
- <span class="ruby-keyword">end</span></pre>
350
- </div>
351
-
352
- </div>
353
-
354
-
355
- </div>
356
-
357
- </section>
358
-
359
- </section>
360
- </main>
361
-