Skip to content

Commit

Permalink
Merge pull request #84 from usgo/FixesPriorToRemovalRatingsPages
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Hiiva authored Jun 8, 2020
2 parents 257ffe3 + 8b9fab0 commit f15012c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 16 deletions.
9 changes: 6 additions & 3 deletions agagd/agagd_core/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ class MemberTable(tables.Table):
'member_detail',
kwargs={"member_id": tables.A('member_id')})
chapter_id = tables.Column(
verbose_name="Chapters"
verbose_name="Chapter"
)
players__rating = tables.Column(
verbose_name="Rating"
)
country = tables.LinkColumn(
'country_detail',
Expand All @@ -109,8 +112,8 @@ def render_chapter_id(self, value):
class Meta:
model = Member
attrs = {"class": "paleblue"}
fields = ('full_name', 'state', 'join_date', 'country')
sequence = ('full_name', 'chapter_id', 'country', 'state', 'join_date', 'member_id')
fields = ('full_name', 'state', 'players__rating', 'join_date', 'country')
sequence = ('full_name', 'players__rating', 'chapter_id', 'country', 'state', 'join_date', 'member_id')

class TopDanTable(tables.Table):
member_id = tables.LinkColumn(
Expand Down
21 changes: 18 additions & 3 deletions agagd/agagd_core/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,25 @@ def search(request):
reverse('member_detail', args=(member_id,))
)
except ValueError:
member_table = MemberTable(
Member.objects.filter(full_name__icontains=query).order_by('family_name')
)
members_query = Member.objects.filter(
Q(member_id=F('players__pin_player'))
).filter(
full_name__icontains=query
).values(
"member_id",
"chapter_id",
"join_date",
"state",
"players__rating",
"country",
"full_name",
"family_name"
).order_by('family_name')

member_table = MemberTable(members_query)

RequestConfig(request, paginate={'per_page': 100}).configure(member_table)

return render(request, 'agagd_core/search_player.html',
{
'member_table': member_table,
Expand Down
8 changes: 4 additions & 4 deletions agagd/static/css/agagd.css
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,9 @@ ps {
margin-bottom:0.7em;
text-align:justify;
line-height:1.5em;
display: block;
}

ul, dl {
ul {
margin-left:1.5em;
}

Expand All @@ -126,12 +125,13 @@ ol {


dt {
padding-left: 20px;
/* padding-left: 20px; */
font-variant: small-caps;
font-weight: bold;
}
dd {
padding-left: 40px; color: #666666;
padding-left: 40px;
color: #666666;
}

li {
Expand Down
8 changes: 4 additions & 4 deletions agagd/templates/agagd_core/member.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
{{ block.super }}
<h2> Player card for <b>{{player.full_name}}</b>, ID #{{player.member_id}}.</h2>
{% include "agagd_core/ratings_graph.html" %}
<p> AGA member since: {{ player.join_date }} <p>
<ps>Expiration Date: {{ player.renewal_due }} </ps>
<ps>Membership type: {{ player.type }} </ps>
<ps> AGA member since: {{ player.join_date }} </ps><br>
<ps>Expiration Date: {{ player.renewal_due }} </ps><br>
<ps>Membership type: {{ player.type }} </ps><br>
<dl>
<dt> Rating: </dt> <dd> {{ rating.rating }} </dd>
<dt style="font-size: 24px"> Rating: </dt> <dd style="font-size: 24px"> {{ rating.rating }} </dd>
<dt> Sigma: </dt> <dd> {{ rating.sigma }} </dd>
<dt> Last Rated At: </dt> <dd> {{ rating.elab_date }} </dd>
<dt> Last Tournament: </dt> <dd> {{ rating.tournament }} </dd>
Expand Down
2 changes: 1 addition & 1 deletion agagd/templates/agagd_core/search_player.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<h2>Search Results</h2>
{% include "agagd_core/_search_pl_form.html" %}

<hr>
<hr class="clearboth">
{% if member_table %}
{% render_table member_table %}
{% else %}
Expand Down
2 changes: 1 addition & 1 deletion agagd/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h3><i><a href="/all_player_ratings/">All Player Ratings</a></i></h3>
{% endblock content %}
</div>
<div id="footer">
<p> The AGAGD is (c) 2019 the American Go Association. </p>
<p> The AGAGD is (c) 2020 the American Go Association. </p>
<p> It is developed and maintained by volunteers. <a href="http://github.com/usgo/agagd">Find us on github!</a></p>
</div>
</div>
Expand Down

0 comments on commit f15012c

Please sign in to comment.