Implements configurable start and end hour of the dayused in schedule

This commit is contained in:
David Sedeño 2017-02-21 20:04:46 +01:00
parent 7000e63700
commit 7fa6d5277d
5 changed files with 22 additions and 1 deletions

View file

@ -43,6 +43,8 @@ There are a couple of environment variables you can set to configure OSEM.
| OSEM_GITHUB_KEY | *string* | OMNIAUTH Developer Key for GitHub | OSEM_GITHUB_KEY | *string* | OMNIAUTH Developer Key for GitHub
| OSEM_GITHUB_SECRET | *string* | OMNIAUTH Developer Secret for GitHub | OSEM_GITHUB_SECRET | *string* | OMNIAUTH Developer Secret for GitHub
| OSEM_SCHEDULE_CELL_SIZE | *integer* | Schedule timeslot size to use (in minutes), should be greater than zero, should be divisor of 60 | OSEM_SCHEDULE_CELL_SIZE | *integer* | Schedule timeslot size to use (in minutes), should be greater than zero, should be divisor of 60
| OSEM_SCHEDULE_START_HOUR | *integer* | Schedule start hour, should be greater than zero
| OSEM_SCHEDULE_END_HOUR | *integer* | Schedule end hour, should be greater than zero
| OSEM_SMTP_ADDRESS | smtp.opensuse.org | The smtp server to use | OSEM_SMTP_ADDRESS | smtp.opensuse.org | The smtp server to use
| OSEM_SMTP_PORT | *int* | The port on the smtp server | OSEM_SMTP_PORT | *int* | The port on the smtp server
| OSEM_SMTP_USERNAME | *string* | The user for the smtp server | OSEM_SMTP_USERNAME | *string* | The user for the smtp server

View file

@ -58,6 +58,14 @@
"description": "Schedule timeslot size in minutes", "description": "Schedule timeslot size in minutes",
"required": false "required": false
}, },
"OSEM_SCHEDULE_START_HOUR": {
"description": "Schedule start hour",
"required": false
},
"OSEM_SCHEDULE_END_HOUR": {
"description": "Schedule end hour",
"required": false
},
"RACK_ENV": { "RACK_ENV": {
"required": false "required": false
}, },

View file

@ -5,6 +5,9 @@ class Schedule < ActiveRecord::Base
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id } has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
START_HOUR = (ENV['OSEM_SCHEDULE_START_HOUR']).nil? ? 9 : ENV['OSEM_SCHEDULE_START_HOUR'].to_i
END_HOUR = (ENV['OSEM_SCHEDULE_END_HOUR']).nil? ? 18 : ENV['OSEM_SCHEDULE_END_HOUR'].to_i
private private
def conference_id def conference_id

View file

@ -3,13 +3,15 @@
/ use smaller cell heights for more compact grids / use smaller cell heights for more compact grids
- cell_height = compact_grid ? 32 : 58 - cell_height = compact_grid ? 32 : 58
- date_event_schedules = @event_schedules.select{ |e| e.start_time.to_date.eql? date } - date_event_schedules = @event_schedules.select{ |e| e.start_time.to_date.eql? date }
- start_hour = Schedule::START_HOUR
- end_hour = Schedule::END_HOUR
.row .row
- @rooms.each do |room| - @rooms.each do |room|
.col-md-2.col-xs-6 .col-md-2.col-xs-6
.room-name .room-name
- room_date_event_schedules = date_event_schedules.select{ |e| e.room == room } - room_date_event_schedules = date_event_schedules.select{ |e| e.room == room }
= room.name = room.name
- (9*cells_per_hour..18*cells_per_hour).each do |slot| - (start_hour*cells_per_hour..end_hour*cells_per_hour).each do |slot|
- hour = slot / cells_per_hour - hour = slot / cells_per_hour
- minutes = (EventType::LENGTH_STEP * (slot % cells_per_hour)).to_s.rjust(2, '0') - minutes = (EventType::LENGTH_STEP * (slot % cells_per_hour)).to_s.rjust(2, '0')
- time = "#{hour}:#{minutes}" - time = "#{hour}:#{minutes}"

View file

@ -56,3 +56,9 @@ OSEM_ICHAIN_ENABLED=false
# Schedule grid parameters, cell size in minutes # Schedule grid parameters, cell size in minutes
OSEM_SCHEDULE_CELL_SIZE=15 OSEM_SCHEDULE_CELL_SIZE=15
# Schedule start hour
OSEM_SCHEDULE_START_HOUR=9
# Schedule end hour
OSEM_SCHEDULE_END_HOUR=18