Class: LecturerTimetableExportStratagy2
- Inherits:
-
AbstractTimetableExportStratagy
- Object
- AbstractTimetableExportStratagy
- LecturerTimetableExportStratagy2
- Defined in:
- lib/tmis/engine/export/timetable_exporter.rb
Instance Method Summary collapse
-
#column_value(date) ⇒ Object
Contract Any => Any.
-
#columns ⇒ Object
TODO Изменить контракты Contract None => RespondTo.
-
#initialize(dates, lecturer) ⇒ LecturerTimetableExportStratagy2
constructor
Contract Or, Lecturer => Any.
-
#row_value(none) ⇒ Object
Contract Any => Any.
-
#rows ⇒ Object
Contract None => Or.
-
#studies(none, date) ⇒ Object
Contract Any, Any => ArrayOf.
Constructor Details
#initialize(dates, lecturer) ⇒ LecturerTimetableExportStratagy2
Contract Or, Lecturer => Any
294 295 296 297 |
# File 'lib/tmis/engine/export/timetable_exporter.rb', line 294 def initialize(dates, lecturer) @dates = dates @lecturer = lecturer end |
Instance Method Details
#column_value(date) ⇒ Object
Contract Any => Any
316 317 318 |
# File 'lib/tmis/engine/export/timetable_exporter.rb', line 316 def column_value(date) date.strftime('%A') end |
#columns ⇒ Object
TODO Изменить контракты Contract None => RespondTo
306 307 308 |
# File 'lib/tmis/engine/export/timetable_exporter.rb', line 306 def columns @dates end |
#row_value(none) ⇒ Object
Contract Any => Any
311 312 313 |
# File 'lib/tmis/engine/export/timetable_exporter.rb', line 311 def row_value(none) "" end |
#rows ⇒ Object
Contract None => Or
300 301 302 |
# File 'lib/tmis/engine/export/timetable_exporter.rb', line 300 def rows [''] end |
#studies(none, date) ⇒ Object
Contract Any, Any => ArrayOf
321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/tmis/engine/export/timetable_exporter.rb', line 321 def studies(none, date) Study.find_by_sql("select studies.* "+ "from studies "+ "join groups on groups.id = studies.groupable_id and studies.groupable_type = 'Group' "+ "where date = '#{date.to_s}' and lecturer_id = #{@lecturer.id} "+ "union "+ "select studies.* "+ "from studies "+ "join subgroups on subgroups.id = studies.groupable_id and studies.groupable_type = 'Subgroup' "+ "where date = '#{date.to_s}' and lecturer_id = #{@lecturer.id}") #Study.of_group_and_its_subgroups(group).where(date: date, lecturer_id: @lecturer).to_a end |