Skip to content

Commit e5ff1b8

Browse files
committed
Add weekly Ration Club event to calendar and update event time in home page
1 parent ca1696b commit e5ff1b8

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

app/controllers/api_controller.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,22 @@ def events
3636
end
3737
end
3838

39+
# Add weekly Ration Club (Wednesdays, 7–10pm)
40+
now_utc = Time.now.utc
41+
days_until_wed = (3 - now_utc.wday) % 7
42+
ration_start = (now_utc.to_date + days_until_wed).to_time + 19.hours
43+
ration_end = ration_start + 3.hours
44+
45+
cal.event do |e|
46+
e.dtstart = Icalendar::Values::DateTime.new(ration_start, tzid: 'UTC')
47+
e.dtend = Icalendar::Values::DateTime.new(ration_end, tzid: 'UTC')
48+
e.summary = 'Ration Club'
49+
e.description = "Register: https://forms.gle/T3rXorsrb4gXKazv9\n\nEach week Newspeak House hosts a community dinner called Ration Club, open to anyone who'd like to find out more about the college and its work."
50+
e.location = 'Newspeak House, 133 Bethnal Green Road, London, E2 7DG, UK'
51+
e.url = 'https://forms.gle/T3rXorsrb4gXKazv9'
52+
e.rrule = Icalendar::Values::Recur.new('FREQ=WEEKLY;BYDAY=WE')
53+
end
54+
3955
render body: cal.to_ical, content_type: 'text/calendar'
4056
end
4157
end

app/views/events/index.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
.event
3535
%a.event-title{:href => "https://forms.gle/T3rXorsrb4gXKazv9"} Ration Club
3636
%br/
37-
%div.event-details Wednesdays • 7:00pm – 9:00pm • Lounge
37+
%div.event-details Wednesdays • 7:00pm – 10:00pm • Lounge
3838
%br/
3939
%a.event-host{:href => "https://bit.ly/edsaperia"} Edward Saperia
4040
%p Each week the college hosts a community dinner called Ration Club. It's open to anyone who'd like to find out more about the college and its work.

app/views/home/index.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
.event
3434
%a.event-title{:href => "https://forms.gle/T3rXorsrb4gXKazv9"} Ration Club
3535
%br/
36-
%div.event-details Wednesdays • 7:00pm – 9:00pm • Lounge
36+
%div.event-details Wednesdays • 7:00pm – 10:00pm • Lounge
3737
%br/
3838
%a.event-host{:href => "https://bit.ly/edsaperia"} Edward Saperia
3939
%p Each week the college hosts a community dinner called Ration Club. It's open to anyone who'd like to find out more about the college and its work. To find out more or if you'd like to attend, please register.

0 commit comments

Comments
 (0)