Skip to content

Commit

Permalink
patch for meeting dates that are removed from official calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
stvnrlly committed Mar 6, 2014
1 parent 03b5fd7 commit 86843e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ancbrigadesite/templates/ancbrigadesite/anc.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<div class="container">
<div class="row" style="text-align: center">
<h1 style="font-size: 36px">ANC {{anc}}</h1>
<div style="margin-top: 3px">Website: <a href="{{ info.website }}">{{ info.website }}</a> | Next meeting: <a href="{{ next_meeting_link }}">{{ next_meeting }}</a></div>
<div style="margin-top: 3px">Website: <a href="{{ info.website }}">{{ info.website }}</a> | Next meeting: <a href="{{ next_meeting_link }}">{{ next_meeting }}</a>{% if link_missing %} - possibly rescheduled {% endif %}</div>
</div>
</div><!-- /container -->
</div><!-- /masthead -->
Expand Down
10 changes: 9 additions & 1 deletion ancbrigadesite/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,16 @@ def get(self, request, anc, *args, **kwargs):
next_meeting = m # this is the first meeting in the future (i.e. the next meeting)
break
if next_meeting != None:
next_meeting_link = meeting_data[anc]["meetings"][next_meeting.strftime("%Y-%m-%dT%H:%M:%S")]["link"]
# Sometimes the meeting disappears from the calendar, which causes problems
try:
next_meeting_link = meeting_data[anc]["meetings"][next_meeting.strftime("%Y-%m-%dT%H:%M:%S")]["link"]
link_missing = False
except KeyError:
next_meeting_link = ""
link_missing = True
else:
next_meeting_link = None
link_missing = False
i = all_meetings.index(next_meeting) if next_meeting is not None else len(all_meetings)
previous_meetings = all_meetings[i-2:i]

Expand Down Expand Up @@ -146,6 +153,7 @@ def first(qs):
'census_stats': census_stats,
'next_meeting': next_meeting,
'next_meeting_link': next_meeting_link,
'link_missing': link_missing,
})

#Using Class Based Views(CBV) to implement our logic
Expand Down

0 comments on commit 86843e2

Please sign in to comment.