Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Khalid Ali
schedules
Commits
de69533a
Commit
de69533a
authored
Aug 16, 2018
by
Zac Wood
Browse files
Fixed bug where calendar generator would crash for sections without
start or end times
parent
f6d25b91
Changes
1
Hide whitespace changes
Inline
Side-by-side
schedules_api/app/controllers/calendar_generator_controller.rb
View file @
de69533a
...
...
@@ -11,8 +11,10 @@ class CalendarGeneratorController < ApplicationController
# the intended format for the json is a list of CRNs
params
[
:_json
].
each
do
|
crn
|
# for each CRN sent by the post request
section
=
CourseSection
.
find_by_crn
(
crn
)
event
=
generate_event_from_section
(
section
)
cal
.
add_event
(
event
)
unless
section
.
start_time
==
"TBA"
||
section
.
end_time
==
"TBA"
event
=
generate_event_from_section
(
section
)
cal
.
add_event
(
event
)
end
end
render
plain:
cal
.
to_ical
# render a plaintext iCal file
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment