Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update officers page and add committee heads #568

Merged
merged 2 commits into from
Dec 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions ocfweb/docs/templates/docs/officers.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h3>
{% endif %}
{% endfor %}
</p>
{% if current_term.dgms|length > 0 %}
{% if current_term.dgms %}
<h4>
Deputy General Managers
</h4>
Expand Down Expand Up @@ -62,7 +62,7 @@ <h3>
{% endif %}
{% endfor %}
</p>
{% if current_term.dsms|length > 0 %}
{% if current_term.dsms %}
<h4>
Deputy Site Managers
</h4>
Expand All @@ -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 %}
<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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we'd make the Anys more specific. Perhaps this can wait until we can use Python 3.7 data classes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will get refactored anyways, assuming someone works on ocf/etc#3

) -> _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],
},
)