Skip to content

Commit

Permalink
Variable name changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptypjeu committed Aug 18, 2023
1 parent 412183b commit 77e089e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion teknologr/katalogen/templates/functionaries.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h3 class="page-header">
</tr>
</thead>
<tbody>
{% for member, duration in functionary_duration_strings %}
{% for member, duration in functionary_durations %}
<tr>
<td order-data="{{ member.public_full_name_for_sorting }}"><a href="{% url 'katalogen:profile' member.id %}">{{ member.public_full_name }}</a></td>
<td order-data="{{ duration.to_sort_string }}">{{ duration }}</td>
Expand Down
2 changes: 1 addition & 1 deletion teknologr/katalogen/templates/group_memberships.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h3 class="page-header">
</tr>
</thead>
<tbody>
{% for member, duration in group_membership_duration_strings %}
{% for member, duration in group_membership_durations %}
<tr>
<td order-data="{{ member.public_full_name_for_sorting }}"><a href="{% url 'katalogen:profile' member.id %}">{{ member.public_full_name }}</a></td>
<td order-data="{{ duration.to_sort_string }}">{{ duration }}</td>
Expand Down
4 changes: 2 additions & 2 deletions teknologr/katalogen/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ <h3 class="list-inline-item">Poster</h3>
<a class="list-inline-item fa fa-compress-arrows-alt" href="?combine=1" title="Kombinera poster och grupper, samt sortera dem i alfabetisk ordning"></a>
{% endif %}
<table class="table table-striped table-borderless table-sm">
{% for ft, duration in functionary_duration_strings %}
{% for ft, duration in functionary_type_durations %}
<tr>
<th><a href="{% url 'katalogen:functionary_type' ft.id %}">{{ ft.name }}</a></td>
<td class="text-right">{{ duration }}</td>
Expand All @@ -118,7 +118,7 @@ <h3 class="list-inline-item">Grupper</h3>
<a class="list-inline-item fa fa-compress-arrows-alt" href="?combine=1" title="Kombinera poster och grupper, samt sortera dem i alfabetisk ordning"></a>
{% endif %}
<table class="table table-striped table-borderless table-sm">
{% for gt, duration in group_type_duration_strings %}
{% for gt, duration in group_type_durations %}
<tr>
<th><a href="{% url 'katalogen:groups' gt.id %}">{{ gt.name }}</a></th>
<td class="text-right">{{ duration }}</td>
Expand Down
26 changes: 13 additions & 13 deletions teknologr/katalogen/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ def profile(request, member_id):
Functionary.order_by(functionaries, by, reverse)
GroupMembership.order_by(group_memberships, by, reverse)

functionary_duration_strings = [(f.functionarytype, f.duration) for f in functionaries]
group_type_duration_strings = [(gm.group.grouptype, gm.group.duration) for gm in group_memberships]
ft_durations = [(f.functionarytype, f.duration) for f in functionaries]
gt_durations = [(gm.group.grouptype, gm.group.duration) for gm in group_memberships]

if combine:
functionary_duration_strings = MultiDuration.combine_per_key(functionary_duration_strings)
group_type_duration_strings = MultiDuration.combine_per_key(group_type_duration_strings)
ft_durations = MultiDuration.combine_per_key(ft_durations)
gt_durations = MultiDuration.combine_per_key(gt_durations)

return render(request, 'profile.html', {
**_get_base_context(request),
# XXX: Could use MemberSerializerPartial to remove any unwanted fields for real instead of just not showing them
'show_all': person.username == request.user.username or person.showContactInformation(),
'person': person,
'combined': combine,
'functionary_duration_strings': functionary_duration_strings,
'group_type_duration_strings': group_type_duration_strings,
'functionary_type_durations': ft_durations,
'group_type_durations': gt_durations,
'decoration_ownerships': person.decoration_ownerships_by_date,
})

Expand Down Expand Up @@ -143,19 +143,19 @@ def functionary_type(request, functionary_type_id):
functionary_type = FunctionaryType.objects.get_prefetched_or_404(functionary_type_id)
functionaries = list(functionary_type.functionaries.all())

functionary_duration_strings = [(f.member, f.duration) for f in functionaries]
durations = [(f.member, f.duration) for f in functionaries]

combine = request.GET.get('combine', '0') != '0'
if combine:
functionary_duration_strings = MultiDuration.combine_per_key(functionary_duration_strings)
durations = MultiDuration.combine_per_key(durations)

# Sort the pairs by date and member name by default
functionary_duration_strings.sort(key=lambda pair: (pair[1], pair[0].public_full_name_for_sorting), reverse=True)
durations.sort(key=lambda pair: (pair[1], pair[0].public_full_name_for_sorting), reverse=True)

return render(request, 'functionaries.html', {
**_get_base_context(request),
'functionary_type': functionary_type,
'functionary_duration_strings': functionary_duration_strings,
'functionary_durations': durations,
'combined': combine,
})

Expand Down Expand Up @@ -190,15 +190,15 @@ def group_memberships(request, group_type_id):
durations = [(gm.member, g.duration) for g in group_type.groups.all() for gm in g.memberships.all()]

# Combine all durations for each Member
gm_duration_strings = MultiDuration.combine_per_key(durations)
durations = MultiDuration.combine_per_key(durations)

# Sort the pairs by member name by default
gm_duration_strings.sort(key=lambda pair: (pair[0].public_full_name_for_sorting))
durations.sort(key=lambda pair: (pair[0].public_full_name_for_sorting))

return render(request, 'group_memberships.html', {
**_get_base_context(request),
'group_type': group_type,
'group_membership_duration_strings': gm_duration_strings,
'group_membership_durations': durations,
})


Expand Down

0 comments on commit 77e089e

Please sign in to comment.