Class: LecturerTimetableExportStratagy
- Inherits:
-
AbstractTimetableExportStratagy
- Object
- AbstractTimetableExportStratagy
- LecturerTimetableExportStratagy
- Defined in:
- lib/tmis/engine/export/timetable_exporter.rb
Instance Method Summary collapse
-
#column_value(group) ⇒ Object
Contract Any => Any.
-
#columns ⇒ Object
TODO Изменить контракты Contract None => RespondTo.
-
#initialize(dates, lecturer) ⇒ LecturerTimetableExportStratagy
constructor
Contract Or, Lecturer => Any.
-
#row_value(date) ⇒ Object
Contract Any => Any.
-
#rows ⇒ Object
Contract None => Or.
-
#studies(date, group) ⇒ Object
Contract Any, Any => ArrayOf.
Constructor Details
#initialize(dates, lecturer) ⇒ LecturerTimetableExportStratagy
Contract Or, Lecturer => Any
169 170 171 172 |
# File 'lib/tmis/engine/export/timetable_exporter.rb', line 169 def initialize(dates, lecturer) @dates = dates @lecturer = lecturer end |
Instance Method Details
#column_value(group) ⇒ Object
Contract Any => Any
191 192 193 |
# File 'lib/tmis/engine/export/timetable_exporter.rb', line 191 def column_value(group) group.title end |
#columns ⇒ Object
TODO Изменить контракты Contract None => RespondTo
181 182 183 |
# File 'lib/tmis/engine/export/timetable_exporter.rb', line 181 def columns Group.where(id: @lecturer.studies.where(date: @dates, groupable_type: 'Group').select(:groupable_id)) end |
#row_value(date) ⇒ Object
Contract Any => Any
186 187 188 |
# File 'lib/tmis/engine/export/timetable_exporter.rb', line 186 def row_value(date) date.strftime('%A') end |
#rows ⇒ Object
Contract None => Or
175 176 177 |
# File 'lib/tmis/engine/export/timetable_exporter.rb', line 175 def rows @dates end |
#studies(date, group) ⇒ Object
Contract Any, Any => ArrayOf
196 197 198 |
# File 'lib/tmis/engine/export/timetable_exporter.rb', line 196 def studies(date, group) Study.of_group_and_its_subgroups(group).where(date: date, lecturer_id: @lecturer).to_a end |