Skip to content

Commit

Permalink
Merge pull request #52 from eaudeweb/old_issues
Browse files Browse the repository at this point in the history
Old issues
  • Loading branch information
Andreea Dima authored Nov 27, 2017
2 parents d3ee360 + ebdecc7 commit 8a9e07e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
21 changes: 19 additions & 2 deletions mrt/meetings/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,24 @@ def process_registration_date(self, participant, val):

def get_queryset(self, **opt):
participants = Participant.query.current_meeting().participants()

ordering = {
key[0]: order
for key, order in zip(
participants.order_by('registration_date asc').values(Participant.id),
range(1, participants.count() + 1))
}

total = participants.count()
for item in opt['order']:
# Special case for column order - sorting by order is identical to sorting
# by registration_date
if item['column'] == 'order':
participants= participants.order_by('registration_date {dir}'.format(
**item))
# Special case for registration_date -> NULL values are turned into
# datetime.min
if item['column'] == 'registration_date':
elif item['column'] == 'registration_date':
direction = {'asc': asc, 'desc': desc}.get(item['dir'])
participants = participants.order_by(direction(coalesce(
Participant.registration_date, datetime.min)))
Expand All @@ -129,7 +142,11 @@ def get_queryset(self, **opt):
participants = search_for_participant(opt['search'], participants)

filtered_total = participants.count()
participants = participants.limit(opt['limit']).offset(opt['start'])
participants = list(participants.limit(opt['limit']).offset(opt['start']))

for i in range(len(participants)):
participants[i].order = ordering[participants[i].id]

return participants, total, filtered_total


Expand Down
2 changes: 2 additions & 0 deletions mrt/templates/meetings/participant/participant/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"bFilter": true,
"sDom": '<"row"<"col-xs-6"l><"#custom-search.col-xs-6">>t<"row"<"col-xs-6"i><"col-xs-6"p>>',
"columns": [
{"data": "order"},
{ "data": "last_name" },
{ "data": "category_id" },
{ "data": "representing" },
Expand Down Expand Up @@ -60,6 +61,7 @@
data-ajax="{{ url_for('.participants_filter') }}">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Category</th>
<th>Representing</th>
Expand Down
7 changes: 5 additions & 2 deletions mrt/templates/meetings/registration/user_login.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<div class="row">

<div class="col-sm-6 col-sm-push-3">
<div class="col-sm-6 col-sm-offset-3">

<div class="panel panel-default">
<div class="panel-heading">
Expand All @@ -21,11 +21,14 @@
{{ form_group(form.password, label_size="4") }}

<div class="row">
<div class="col-sm-8 col-sm-push-4">
<div class="col-sm-4 col-sm-offset-4">
<button type="submit" class="btn btn-primary">
Login</button> or
<a href="{{ url_for('.registration') }}">Cancel</a>
</div>
<div class="col-sm-4 text-right">
<a href="{{ url_for('auth.recover') }}">Forgot password?</a>
</div>
</div>

</div> {# panel-body #}
Expand Down

0 comments on commit 8a9e07e

Please sign in to comment.