Skip to content

Commit

Permalink
update officers page and add committee heads
Browse files Browse the repository at this point in the history
  • Loading branch information
cg505 committed Dec 13, 2019
1 parent 9edc834 commit cc6d18e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
20 changes: 20 additions & 0 deletions ocfweb/docs/templates/docs/officers.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,26 @@ <h4>
the OCF lab and other services. They are elected by the Board of
Directors at the end of each semester.
</p>
{% if current_term.heads|length > 0 %}
<h3>
Committee Heads
</h3>
{% for committee in current_term.heads %}
<h4>{{ committee.name }} Committee Heads</h4>
<p>
{% for head in committee.heads %}
{% if head.end is None %}
<strong>{{ head.name }}</strong> &lt;{{ head.uid }}&gt;
{% if head.acting %} (acting) {% endif %}<br>
{% endif %}
{% endfor %}
</p>
{% endfor %}
<p>
Committee heads guide the work of the various committees that
function within the OCF.
</p>
{% endif %}
<h2>Previous officers</h2>
<p>
Terms began and ended during the ninth week of the semester until Fall
Expand Down
32 changes: 28 additions & 4 deletions ocfweb/docs/views/officers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

from ocfweb import caching

_Term = namedtuple('_Term', ['name', 'gms', 'sms', 'dgms', 'dsms'])
_Term = namedtuple('_Term', ['name', 'gms', 'sms', 'dgms', 'dsms', 'heads'])
Committee = namedtuple('Committee', ['name', 'heads'])


def Term(
Expand All @@ -24,12 +25,17 @@ def Term(
sms: List[Any],
dgms: Optional[List[Any]] = None,
dsms: Optional[List[Any]] = None,
heads: Optional[List[Tuple[str, List[Any]]]] = None,
) -> _Term:
gms = list(map(Officer.from_uid_or_info, gms))
sms = list(map(Officer.from_uid_or_info, sms))
dgms = list(map(Officer.from_uid_or_info, dgms or []))
dsms = list(map(Officer.from_uid_or_info, dsms or []))
return _Term(name, gms, sms, dgms, dsms)
heads = [
Committee(committee[0], list(map(Officer.from_uid_or_info, committee[1])))
for committee in heads or []
]
return _Term(name, gms, sms, dgms, dsms, heads)


class Officer(namedtuple('Officer', ['uid', 'name', 'start', 'end', 'acting'])):
Expand Down Expand Up @@ -237,7 +243,25 @@ def _bod_terms() -> List[Any]:
dgms=['asai'], dsms=['ethanhs', 'cooperc'],
),
Term(
'Fall 2019', gms=['cooperc', 'php'], sms=['ethanhs', 'fydai'],
'Fall 2019',
gms=['cooperc', 'php'],
sms=[
('ethanhs', date(2019, 5, 18), date(2019, 11, 18)),
'fydai',
],
),
Term(
'Spring 2020',
gms=['dphan', 'bernardzhao'],
sms=['cooperc', 'jaw'],
heads=[
('University Affairs', ['dphan', 'bernardzhao']),
('Internal', ['php', 'kmo']),
('Industry and Alumni Relations', ['asai', 'rachy']),
('Finance', ['ncberberi', 'nint']),
('Communication', ['rachy']),
('DeCal', ['exiang', 'bencuan', 'kmo']),
],
),
]

Expand All @@ -250,6 +274,6 @@ def officers(doc: Any, request: HttpRequest) -> HttpResponse:
{
'title': doc.title,
'current_term': terms[-1],
'previous_terms': reversed(terms[:-1]),
'previous_terms': terms[-2::-1],
},
)

0 comments on commit cc6d18e

Please sign in to comment.