+ <%= event.start.strftime("%H:%M %Z") %> + <%= event.formatted_summary.sub(nsltv_regex, '') %> +
+diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2c44635..fcf1e89 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -171,8 +171,26 @@ module ApplicationHelper end end + def nsltv_regex + /\[NSLTV\]/i + end + def upcoming_matches - GoogleCalendar.new(ENV['GOOGLE_CALENDAR_ID'], timezone_offset).upcoming.sort_by do |event| + GoogleCalendar.new(ENV['GOOGLE_CALENDAR_ID'], timezone_offset). + upcoming. + find_all{|e| + not nsltv_regex =~ (e.summary) + }.sort_by do |event| + event.start + end + end + + def upcoming_nsltv + GoogleCalendar.new(ENV['GOOGLE_CALENDAR_ID'], timezone_offset). + upcoming. + find_all{|e| + nsltv_regex =~ (e.summary) + }.sort_by do |event| event.start end end diff --git a/app/views/widgets/_calendar.html.erb b/app/views/widgets/_calendar.html.erb index ccb3094..9dc7fbd 100644 --- a/app/views/widgets/_calendar.html.erb +++ b/app/views/widgets/_calendar.html.erb @@ -2,7 +2,7 @@