diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 00000000..6c24913f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,40 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +## Summary of the Bug +A clear and concise description of what the bug is. + +## Steps to Reproduce the Behaviour +**i.e.,** +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +## The Expected Behaviour +Concise description of what you expected to happen. + +## Screenshots +If applicable, add screenshots to help explain your problem. + +## Hardware and Software Information + +### Desktop + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +### Smartphone + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +## Notes +Add any other information about the bug which you thing may be helpful. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..7cb9e1a4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement, feature request +assignees: '' + +--- + +## Is your feature request related to a problem? +A clear and concise description of what you would like to see added to the AGAGD. + +## Describe the feature you'd like to see on the AGAGD. +A clear and concise description of the feature you would like to see. + +## Notes +Add any other information or screenshots about the feature request here. diff --git a/agagd/agagd/settings/base.py b/agagd/agagd/settings/base.py index bc07a434..7f5e9c2c 100644 --- a/agagd/agagd/settings/base.py +++ b/agagd/agagd/settings/base.py @@ -3,13 +3,13 @@ PROJECT_ROOT = os.environ['PROJECT_ROOT'] -ADMINS = ( - ('Andrew Jackson', 'operations@usgo.org'), -) +ADMINS = [ + ('Admins', 'webmaster@usgo.org'), +] MANAGERS = ADMINS -ALLOWED_HOSTS = ['test.agagd.usgo.org', 'agagd.usgo.org'] +ALLOWED_HOSTS = ['localhost', 'test.agagd.usgo.org', 'agagd.usgo.org'] # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name @@ -36,12 +36,12 @@ # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/home/media/media.lawrence.com/media/" -MEDIA_ROOT = '' +MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media') # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" -MEDIA_URL = '' +MEDIA_URL = '/media/' # Absolute path to the directory static files should be collected to. # Don't put anything in this directory yourself; store your static files diff --git a/agagd/agagd/settings/prod.py b/agagd/agagd/settings/prod.py index cd691e3a..c13f6b26 100644 --- a/agagd/agagd/settings/prod.py +++ b/agagd/agagd/settings/prod.py @@ -34,4 +34,4 @@ } } -TEMPLATE_DIRS = (_templates, ) +TEMPLATES[0]['DIRS'] = [ _templates ] diff --git a/agagd/agagd/urls.py b/agagd/agagd/urls.py index 0ea4b62d..c54fbc59 100644 --- a/agagd/agagd/urls.py +++ b/agagd/agagd/urls.py @@ -1,4 +1,6 @@ from django.conf.urls import url +from django.conf.urls.static import static +from django.conf import settings from django.core.urlresolvers import reverse_lazy from django.views.generic import RedirectView from agagd_core import views as agagd_views @@ -13,6 +15,7 @@ url(r'^country/(?P[\w ]+)/$', agagd_views.country_detail, name='country_detail'), url(r'^player/(?P\d+)/vs/$', agagd_views.find_member_vs, name='find_member_vs'), url(r'^player/(?P\d+)/vs/(?P\d+)$', agagd_views.member_vs, name='member_vs'), + url(r'^all_player_ratings/$', agagd_views.all_player_ratings, name='all_player_ratings'), url(r'^ratings/(?P\d+)/$', agagd_views.member_ratings, name='member_ratings'), url(r'^gamestats/$', agagd_views.game_stats, name='game_stats'), @@ -23,4 +26,4 @@ # Static Pages url(r'^information/$', agagd_views.information), url(r'^qualifications/$', agagd_views.qualifications) -] +] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/agagd/agagd/wsgi.py b/agagd/agagd/wsgi.py index bbd96a17..346a9973 100644 --- a/agagd/agagd/wsgi.py +++ b/agagd/agagd/wsgi.py @@ -20,16 +20,13 @@ # This application object is used by any WSGI server configured to use this # file. This includes Django's development server, if the WSGI_APPLICATION # setting points here. -import django.core.handlers.wsgi -_application = django.core.handlers.wsgi.WSGIHandler() +from django.core.wsgi import get_wsgi_application -def application(environ, start_response): +def bootstrap_env(environ, start_response): for key in ['DJANGO_SETTINGS_MODULE', 'AGAGD_USER', 'MYSQL_PASS', 'APP_DB_NAME', 'SECRET_KEY', 'TEMPLATE_DIR']: if key in environ: os.environ[key] = environ[key] + _application = get_wsgi_application() return _application(environ, start_response) - -# Apply WSGI middleware here. -# from helloworld.wsgi import HelloWorldApplication -# application = HelloWorldApplication(application) +application = bootstrap_env diff --git a/agagd/agagd_core/json_response.py b/agagd/agagd_core/json_response.py index e7e5667d..e19974cb 100644 --- a/agagd/agagd_core/json_response.py +++ b/agagd/agagd_core/json_response.py @@ -4,14 +4,14 @@ from django.core.serializers import json, serialize from django.db.models.query import QuerySet from django.http import HttpResponse -import simplejson +import json as python_json class JsonResponse(HttpResponse): def __init__(self, object): if isinstance(object, QuerySet): content = serialize('json', object) else: - content = simplejson.dumps( + content = python_json.dumps( object, indent=2, cls=json.DjangoJSONEncoder, ensure_ascii=False) super(JsonResponse, self).__init__( diff --git a/agagd/agagd_core/models.py b/agagd/agagd_core/models.py index ce2000ab..ac654cf5 100644 --- a/agagd/agagd_core/models.py +++ b/agagd/agagd_core/models.py @@ -24,6 +24,7 @@ class Meta: join_date = models.DateField(null=True, blank=True) city = models.CharField(max_length=255, blank=True) state = models.CharField(max_length=255, blank=True) + status = models.CharField(max_length=255, null=True) region = models.CharField(max_length=255, blank=True) country = models.CharField(max_length=255) chapter = models.CharField(max_length=100, blank=True) @@ -45,6 +46,9 @@ class Meta: managed = False class Chapters(models.Model): + # ForeignKey for Member + member = models.ForeignKey(Member) + # TODO this is not member_id? seems more like a normal pk for ChapterInfo member_id = models.CharField(max_length=255, primary_key=True) # This field type is a guess. name = models.CharField(max_length=255, blank=True) @@ -202,7 +206,19 @@ def winner(self): def won_by(self, p1): return self.winner() == p1 +# Updated Rating Information Table for Players. +class Players(models.Model): + pin_player = models.ForeignKey(Member, db_column=u'Pin_Player', primary_key=True) + rating = models.FloatField(db_column=u'Rating') # x. This field type is a guess. + sigma = models.FloatField(db_column=u'Sigma') # x. This field type is a guess. + elab_date = models.DateField(db_column=u'Elab_Date') + class Meta: + managed = False + db_table = u'players' + class Rating(models.Model): + # ForeignKey for the Members + member_id = models.ForeignKey(Member, db_column=u'Pin_Player') pin_player = models.ForeignKey(Member, db_column=u'Pin_Player', related_name='ratings_set', primary_key=True) tournament = models.ForeignKey(Tournament, db_column=u'Tournament_Code', related_name='ratings_set') rating = models.FloatField(db_column=u'Rating') # x. This field type is a guess. diff --git a/agagd/agagd_core/tables.py b/agagd/agagd_core/tables.py index c0519ce8..638dd57e 100644 --- a/agagd/agagd_core/tables.py +++ b/agagd/agagd_core/tables.py @@ -1,5 +1,8 @@ import django_tables2 as tables -from agagd_core.models import Game, Member, Tournament, TopDan, TopKyu, MostTournamentsPastYear, MostRatedGamesPastYear +from django.core.urlresolvers import reverse +from django.core.exceptions import ObjectDoesNotExist +from django.utils.safestring import mark_safe +from agagd_core.models import Chapters, Game, Member, Tournament, TopDan, TopKyu, MostTournamentsPastYear, MostRatedGamesPastYear class WinnerColumn(tables.LinkColumn): def __init__(self, color, *args, **kwargs): @@ -16,16 +19,16 @@ def render(self, value, record, bound_column): #Standard gameTable display as is on agagd.usgo.org and most pages class GameTable(tables.Table): pin_player_1 = WinnerColumn('W', - viewname='agagd_core.views.member_detail', + viewname='member_detail', verbose_name="white player", kwargs={"member_id":tables.A('pin_player_1.member_id')}) pin_player_2 = WinnerColumn('B', - 'agagd_core.views.member_detail', + viewname='member_detail', verbose_name="black player", kwargs={"member_id":tables.A('pin_player_2.member_id')}) tournament_code = tables.LinkColumn( verbose_name="Tournament", - viewname='agagd_core.views.tournament_detail', + viewname='tournament_detail', kwargs={'tourn_code':tables.A('tournament_code.tournament_code')},) class Meta: @@ -39,11 +42,11 @@ class Meta: #Modified gaeTable to remove duplicate tournament listing displayed on the page, GitHubIssue#20 class GameTable2(tables.Table): pin_player_1 = WinnerColumn('W', - viewname='agagd_core.views.member_detail', + viewname='member_detail', verbose_name="white player", kwargs={"member_id":tables.A('pin_player_1.member_id')}) pin_player_2 = WinnerColumn('B', - 'agagd_core.views.member_detail', + 'member_detail', verbose_name="black player", kwargs={"member_id":tables.A('pin_player_2.member_id')}) class Meta: @@ -63,7 +66,7 @@ def __init__(self, qs, p1, *args, **kwargs): empty_text = "Opponent information couldn't be calculated" opponent = tables.LinkColumn( - 'agagd_core.views.member_detail', + 'member_detail', kwargs={"member_id": tables.A('opponent.member_id')}) total = tables.Column(verbose_name="Games") won = tables.Column(verbose_name="Won", default=0) @@ -79,30 +82,45 @@ class Meta: class MemberTable(tables.Table): member_id = tables.LinkColumn( - 'agagd_core.views.member_detail', + 'member_detail', kwargs={"member_id": tables.A('member_id')}) - chapter = tables.LinkColumn( - 'agagd_core.views.chapter_detail', - kwargs={"chapter_code": tables.A('chapter')}) + chapter_id = tables.Column( + verbose_name="Chapter" + ) + players__rating = tables.Column( + verbose_name="Rating" + ) country = tables.LinkColumn( - 'agagd_core.views.country_detail', + 'country_detail', kwargs={"country_name": tables.A('country')}) full_name = tables.LinkColumn( - 'agagd_core.views.member_detail', + 'member_detail', kwargs={'member_id': tables.A('member_id')}) + def render_chapter_id(self, value): + try: + members_chapter = Chapters.objects.get(member_id=value) + + chapter_url = reverse( + viewname='chapter_detail', + kwargs={'chapter_code': members_chapter.code}) + chapter_html = mark_safe("{}".format(chapter_url, members_chapter.code)) + except: + chapter_html = u"\u2014" + return chapter_html + class Meta: model = Member attrs = {"class": "paleblue"} - fields = ('full_name', 'state', 'join_date', 'country') - sequence = ('full_name', 'chapter', '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( - 'agagd_core.views.member_detail', + 'member_detail', kwargs={"member_id": tables.A('member_id')}) full_name = tables.LinkColumn( - 'agagd_core.views.member_detail', + 'member_detail', kwargs={'member_id': tables.A('member_id')}) class Meta: model = TopDan @@ -112,10 +130,10 @@ class Meta: class TopKyuTable(tables.Table): member_id = tables.LinkColumn( - 'agagd_core.views.member_detail', + 'member_detail', kwargs={"member_id": tables.A('member_id')}) full_name = tables.LinkColumn( - 'agagd_core.views.member_detail', + 'member_detail', kwargs={'member_id': tables.A('member_id')}) class Meta: model = TopKyu @@ -125,10 +143,10 @@ class Meta: class MostRatedGamesPastYearTable(tables.Table): pin = tables.LinkColumn( - 'agagd_core.views.member_detail', + 'member_detail', kwargs={'member_id': tables.A('pin')}) name = tables.LinkColumn( - 'agagd_core.views.member_detail', + 'member_detail', kwargs={'member_id': tables.A('pin')}) class Meta: model = MostRatedGamesPastYear @@ -138,10 +156,10 @@ class Meta: class MostTournamentsPastYearTable(tables.Table): pin = tables.LinkColumn( - 'agagd_core.views.member_detail', + 'member_detail', kwargs={'member_id': tables.A('pin')}) name = tables.LinkColumn( - 'agagd_core.views.member_detail', + 'member_detail', kwargs={'member_id': tables.A('pin')}) class Meta: model = MostTournamentsPastYear @@ -149,10 +167,60 @@ class Meta: fields = ('pin', 'name', 'total') sequence = fields +class AllPlayerRatingsTable(tables.Table): + full_name = tables.LinkColumn( + 'member_detail', + kwargs={ + "member_id": tables.A('member_id') + } + ) + member_id = tables.LinkColumn( + 'member_detail', + kwargs={ + "member_id": tables.A('member_id') + } + ) + type = tables.Column() + players__rating = tables.Column() + chapter_id = tables.Column( + verbose_name="Chapter" + ) + state = tables.Column() + players__sigma = tables.Column( + verbose_name="Sigma" + ) + + def render_chapter_id(self, value): + try: + members_chapter = Chapters.objects.get(member_id=value) + + if members_chapter.code is not None: + chapter_url = reverse( + viewname='chapter_detail', + kwargs={'chapter_code': members_chapter.code}) + chapter_html = mark_safe("{}".format(chapter_url, members_chapter.name)) + else: + chapter_html = u"\u2014" + except: + chapter_html = u"\u2014" + return chapter_html + + class Meta: + attrs = {"class": "paleblue"} + fields = ( + 'full_name', + 'member_id', + 'players__rating', + 'players__sigma', + 'type', + 'chapter_id', + 'state', + ) + sequence = fields class TournamentTable(tables.Table): tournament_code = tables.LinkColumn( - 'agagd_core.views.tournament_detail', + 'tournament_detail', kwargs={'tourn_code':tables.A('tournament_code')},) elab_date = tables.Column(verbose_name="rated on") @@ -164,7 +232,7 @@ class Meta: class TournamentPlayedTable(tables.Table): tournament = tables.LinkColumn( - 'agagd_core.views.tournament_detail', + 'tournament_detail', kwargs={'tourn_code':tables.A('tournament.pk')},) date = tables.Column(default="Unknown") won = tables.Column(verbose_name="Won", default=0) diff --git a/agagd/agagd_core/views/core.py b/agagd/agagd_core/views/core.py index 07792276..04e6acad 100644 --- a/agagd/agagd_core/views/core.py +++ b/agagd/agagd_core/views/core.py @@ -1,12 +1,12 @@ from agagd_core.json_response import JsonResponse from agagd_core.models import Game, Member, Tournament, TopDan, TopKyu, MostRatedGamesPastYear, MostTournamentsPastYear, Chapters, Country from agagd_core.tables import GameTable, GameTable2, MemberTable, TournamentTable, TopDanTable, TopKyuTable, OpponentTable, TournamentPlayedTable -from agagd_core.tables import MostRatedGamesPastYearTable, MostTournamentsPastYearTable +from agagd_core.tables import AllPlayerRatingsTable, MostRatedGamesPastYearTable, MostTournamentsPastYearTable from agagd_core.ratings_top_ten_requests import RatingsTopRequest from datetime import datetime, timedelta, date from django.core import exceptions from django.core.urlresolvers import reverse -from django.db.models import Q, Count +from django.db.models import F, Q, Count from django.http import HttpResponseRedirect from django.shortcuts import render, get_object_or_404 from django.views.decorators.http import require_POST, require_GET @@ -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, @@ -197,9 +212,49 @@ def chapter_detail(request, chapter_code): def country_detail(request, country_name): member_table = MemberTable(Member.objects.filter(country=country_name).order_by('family_name') ) + + RequestConfig(request, paginate={'per_page': 100}).configure(member_table) + return render(request, 'agagd_core/country.html', - { 'member_table': member_table, }) - + { + 'country_name': country_name, + 'member_table': member_table, }) + +def all_player_ratings(request): + all_player_ratings_query = Member.objects.filter( + Q(chapter_id=F('chapters__member_id')) | + Q(chapters__member_id__isnull=True) + ).filter( + Q(member_id=F('players__pin_player')) + ).filter( + status='accepted' + ).exclude( + rating__rating__isnull=True + ).exclude( + type='chapter' + ).exclude( + type='e-journal' + ).exclude( + type='library' + ).exclude( + type='institution' + ).values( + "full_name", + "member_id", + "type", + "players__rating", + "chapter_id", + "state", + "players__sigma", + ).order_by('-players__rating') + + all_player_ratings_table = AllPlayerRatingsTable(all_player_ratings_query) + RequestConfig(request, paginate={'per_page': 50}).configure(all_player_ratings_table) + + return render(request, 'agagd_core/all_player_ratings.html', { + 'all_player_ratings_table': all_player_ratings_table, + }) + @require_GET def tournament_list(request): tourneys = Tournament.objects.order_by('-tournament_date') diff --git a/agagd/media/aga-logo-48x48.png b/agagd/media/aga-logo-48x48.png new file mode 100644 index 00000000..aa01c386 Binary files /dev/null and b/agagd/media/aga-logo-48x48.png differ diff --git a/agagd/static/css/agagd.css b/agagd/static/css/agagd.css index 26945400..992743cb 100644 --- a/agagd/static/css/agagd.css +++ b/agagd/static/css/agagd.css @@ -49,15 +49,18 @@ blockquote, q { #header { margin-top: 10px; margin-bottom: 10px; - margin-right: 10%; - float:right; +} + +.frontpage-search form { + padding-top: .25em; + margin-top: .25em; } #container { padding-top: 1.5em; margin: auto; - max-width: 80%; + width: 80%; } #footer { @@ -113,10 +116,9 @@ ps { margin-bottom:0.7em; text-align:justify; line-height:1.5em; - display: block; } -ul, dl { +ul { margin-left:1.5em; } @@ -126,12 +128,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 { @@ -162,9 +165,9 @@ a:hover { font-style: italic; } -#ratings_graph { +/*#ratings_graph { float: right; -} +}*/ .axis path, .axis line { @@ -203,16 +206,203 @@ div.ui-datepicker{ font-size:10px; } +/* + * Forms + */ + +.player-search { + display: grid; +} + +.player-search input,button { + margin: .25em 0; +} + +.tournament-search { + display: grid; +} + +.tournament-search input,button { + margin: .25em 0; + margin-right: .25em; +} + +.frontpage-search-item { + padding: .5em 0; +} + +.frontpage-search-item h1,h2,h3,h4,h5,h6 { + margin-bottom: .125em; +} + +@media all and (min-width: 576px) { + .player-search { + display: inline; + } + + .tournament-search { + display: grid; + width: 60%; + } +} + +@media all and (min-width: 768px) { + .tournament-search { + display: inline-flex; + } +} + +/* + * Logos + */ +.footer-aga-logo { + margin: 0; + padding: 0; + display: block; + text-indent: -9999em; + background-image: url("/media/aga-logo-48x48.png"); + background-repeat: no-repeat; + background-size: contain; + background-position: center; + height: 48px; +} + +.footer-aga-logo-container { + margin: .25em auto; + display: block; + float: none; + width: 100%; +} + +.aga-copyright { + margin: 0; + padding: 0; + display: block; + text-align: center; +} + +.aga-copyright-container { + margin: .25em auto; + display: block; + float: none; + width: 100%; +} + +@media all and (min-width: 768px) { + .footer-aga-logo { + margin: 0 0 0 1em; + display: block; + background-position: left center; + } + + .footer-aga-logo-container { + float: left; + width: 49%; + } + + .aga-copyright { + display: table-cell; + text-align: right; + height: 48px; + vertical-align: bottom; + } + + .aga-copyright-container { + display: table; + float: left; + width: 49%; + } +} + +/* + * Layout + */ +.header-col { + float: none; + width: 100%; + padding: .25em; +} + +.header-title h2 { + margin-top: 0; +} + +.responsive-row { + margin-top: 0; +} + +.responsive-row:after { + content: ""; + clear: both; + display: table; +} + +.right-menu { + margin 0; + padding: 0; + display: block; +} + +.right-menu ul { + list-style: none; +} + +.right-menu ul li { + margin: 0; + padding: 0; + text-align: left; + display: list-item; +} + +.footer-row { + margin-top: 1.5em; +} + +@media all and (min-width: 768px) { + .header-col { + float: left; + width: 49%; + } + + .right-menu { + margin 0; + padding: 0; + display: block; + } + + .right-menu ul li { + margin: 0; + padding: 0; + text-align: right; + display: list-item; + } + +} + +/* + * Columns + */ +.left-column { + float: left; +} + +.right-column { + float: right; +} .flex-row { display: flex } .flex-column { - margin: 1em; flex: 50%; } +.flex-column:not(:first-child) { + margin-left: .5em; +} + .clearboth { clear: both } + diff --git a/agagd/templates/agagd_core/_search_tournaments.html b/agagd/templates/agagd_core/_search_tournaments.html new file mode 100644 index 00000000..b2ba6627 --- /dev/null +++ b/agagd/templates/agagd_core/_search_tournaments.html @@ -0,0 +1,12 @@ + + + diff --git a/agagd/templates/agagd_core/all_player_ratings.html b/agagd/templates/agagd_core/all_player_ratings.html new file mode 100644 index 00000000..1759a50b --- /dev/null +++ b/agagd/templates/agagd_core/all_player_ratings.html @@ -0,0 +1,32 @@ +{% extends "base.html" %} +{% load staticfiles %} +{% load render_table from django_tables2 %} + +{% block title %} AGAGD - All Player Ratings {% endblock %} +{% block stylesheets %} {{ block.super }} {% endblock %} + +{% load render_table from django_tables2 %} +{% block header_title %} +
+

+ AGAGD +

+ +

All Player's Ratings

+
+{% endblock header_title %} + +{% block header %} +
+
+ + {% include "agagd_core/fetch_player_form.html" %} +
+
+ +
+{% endblock header %} + +{% block content %} + {% render_table all_player_ratings_table %} +{% endblock %} diff --git a/agagd/templates/agagd_core/chapter.html b/agagd/templates/agagd_core/chapter.html index 2e02cd64..b595f487 100644 --- a/agagd/templates/agagd_core/chapter.html +++ b/agagd/templates/agagd_core/chapter.html @@ -3,16 +3,26 @@ {% load staticfiles %} {% load render_table from django_tables2 %} -{% block title %} Chapter Detail for ... {% endblock %} +{% block title %} Chapter Detail for {{ chapter.name }} {% endblock %} {% block stylesheets %} {{ block.super }} {% endblock stylesheets %} + +{% block header_title %} +
+

+ AGAGD +

+ + {% if chapter.name %} +

Chapter: {{ chapter.name }} - {{ chapter.code }}

+ {% else %} +

Chapter: {{ chapter.code }}

+ {% endif %} +
+{% endblock header_title %} + {% block content %} {{ block.super }} - {% if chapter.name %} -

Chapter: {{ chapter.name }} - {{ chapter.code }}

- {% else %} -

Chapter: {{ chapter.code }}

- {% endif %}
City:
{{ chapter.meeting_city }}
diff --git a/agagd/templates/agagd_core/country.html b/agagd/templates/agagd_core/country.html index d8ade1c0..433608fc 100644 --- a/agagd/templates/agagd_core/country.html +++ b/agagd/templates/agagd_core/country.html @@ -3,13 +3,21 @@ {% load staticfiles %} {% load render_table from django_tables2 %} -{% block title %} Members by Country -- {{ country_name }} {% endblock %} +{% block title %} Members by Country {{ country_name }} {% endblock %} {% block stylesheets %} {{ block.super }} {% endblock stylesheets %} -{% block content %} -{{ block.super }} -

Country: {{ country_name }}

+{% block header_title %} +
+

+ AGAGD +

+ +

Country: {{ country_name }}

+
+{% endblock header_title %} +{% block content %} +{{ block.super }}

Members

{% render_table member_table %} diff --git a/agagd/templates/agagd_core/fetch_player_form.html b/agagd/templates/agagd_core/fetch_player_form.html index edaaa94e..5cdc463e 100644 --- a/agagd/templates/agagd_core/fetch_player_form.html +++ b/agagd/templates/agagd_core/fetch_player_form.html @@ -1,5 +1,5 @@ -
+ - +
diff --git a/agagd/templates/agagd_core/index.html b/agagd/templates/agagd_core/index.html index c8cd5705..838e5c65 100644 --- a/agagd/templates/agagd_core/index.html +++ b/agagd/templates/agagd_core/index.html @@ -1,65 +1,80 @@ - -{% extends "base.html" %} +{% extends "base.html" %} {% load staticfiles %} {% load render_table from django_tables2 %} - {% block title %} AGAGD - The AGA Games Database {% endblock %} {% block stylesheets %} {{ block.super }} {% endblock stylesheets %} + +{% block header_title %} +
+

+ AGAGD +

+ +

The AGA Games Database

+
+{% endblock header_title %} + +{% block header %} + +{% endblock header %} + {% block content %} -{{ block.super }} -

- {% include "agagd_core/fetch_player_form.html" %} -

-

- Search tournaments -

-

Games Recorded Per Day

-{% include "agagd_core/game_count_graph.html" %} -

Tournaments

-{% if tournaments %} - {% render_table tournaments %} -{% else %} -

No Tournaments are available.

-{% endif %} + {{ block.super }} + +
+ +

Games Recorded Per Day

+ + {% include "agagd_core/game_count_graph.html" %} + +

Tournaments

-

Games played in the last 180 days

- {% if table %} - {% render_table table %} - {% else %} -

No games are available.

- {% endif %} + {% if tournaments %} + {% render_table tournaments %} + {% else %} +

No Tournaments are available.

+ {% endif %} -
- - {% if top_dan_table %} -
-

Top Dan Players

- {% render_table top_dan_table %} -
- {% endif %} +

Games played in the last 180 days

+ {% if table %} + {% render_table table %} + {% else %} +

No games are available.

+ {% endif %} - {% if top_kyu_table %} -
-

Top Kyu Players

- {% render_table top_kyu_table %} -
- {% endif %} -
-
+
+ {% if top_dan_table %} +
+

Top Dan Players

+ {% render_table top_dan_table %} +
+ {% endif %} - {% if most_rated_games_table %} -
-

Most Rated Games (Past 12 Months)

- {% render_table most_rated_games_table %} -
- {% endif %} + {% if top_kyu_table %} +
+

Top Kyu Players

+ {% render_table top_kyu_table %} +
+ {% endif %} +
- {% if most_tournaments_table %} -
-

Most Tournaments (Past 12 Months)

- {% render_table most_tournaments_table %} -
- {% endif %} -
+
+ {% if most_rated_games_table %} +
+

Most Rated Games (Past 12 Months)

+ {% render_table most_rated_games_table %} +
+ {% endif %} + {% if most_tournaments_table %} +
+

Most Tournaments (Past 12 Months)

+ {% render_table most_tournaments_table %} +
+ {% endif %} +
{% endblock %} diff --git a/agagd/templates/agagd_core/member.html b/agagd/templates/agagd_core/member.html index 1df5594b..b8920d17 100644 --- a/agagd/templates/agagd_core/member.html +++ b/agagd/templates/agagd_core/member.html @@ -5,24 +5,54 @@ {% block title %} Player card for {{player.full_name}} {% endblock %} {% block stylesheets %} {{ block.super }} {% endblock %} + +{% block header_title %} +
+

+ AGAGD +

+ +

Player card for {{player.full_name}}, ID #{{player.member_id}}.

+
+{% endblock header_title %} + {% block header %} {% endblock %} {% block content %} {{ block.super }} -

Player card for {{player.full_name}}, ID #{{player.member_id}}.

-{% include "agagd_core/ratings_graph.html" %} -

AGA member since: {{ player.join_date }}

-Expiration Date: {{ player.renewal_due }} -Membership type: {{ player.type }} -

-
Rating:
{{ rating.rating }}
-
Sigma:
{{ rating.sigma }}
-
Last Rated At:
{{ rating.elab_date }}
-
Last Tournament:
{{ rating.tournament }}
-
Highest Rating:
{{ max_rating }}
-
+ +
+ +
+
+
+
AGA member since:
+
{{ player.join_date }}
+
Expiration Date:
+
{{ player.renewal_due }}
+
Membership type:
+
{{ player.type }}
+
Rating:
+
{{ rating.rating }}
+
Highest Rating:
+
{{ max_rating }}
+
Sigma:
+
{{ rating.sigma }}
+
Last Rated At:
+
{{ rating.elab_date }}
+
Last Tournament:
+
{{ rating.tournament }}
+
+
+ +
+ {% include "agagd_core/ratings_graph.html" %} +
+
+
+
{% csrf_token %}

Find matchups of {{player.full_name}} against AGA ID# diff --git a/agagd/templates/agagd_core/ratings_graph.html b/agagd/templates/agagd_core/ratings_graph.html index 4dcb5cf4..c19785b0 100644 --- a/agagd/templates/agagd_core/ratings_graph.html +++ b/agagd/templates/agagd_core/ratings_graph.html @@ -52,7 +52,7 @@ .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); -d3.json("{% url "agagd_core.views.member_ratings" player.member_id %}", function(error, data) { +d3.json("{% url "member_ratings" player.member_id %}", function(error, data) { data.forEach(function(d) { d.elab_date = parseDate(d.elab_date); if (d.rating < 1) d.rating = d.rating + 2; diff --git a/agagd/templates/agagd_core/right_header_column.html b/agagd/templates/agagd_core/right_header_column.html new file mode 100644 index 00000000..2ef3fba9 --- /dev/null +++ b/agagd/templates/agagd_core/right_header_column.html @@ -0,0 +1,10 @@ +

diff --git a/agagd/templates/agagd_core/search_player.html b/agagd/templates/agagd_core/search_player.html index a5d9fccc..55174b2a 100644 --- a/agagd/templates/agagd_core/search_player.html +++ b/agagd/templates/agagd_core/search_player.html @@ -4,15 +4,38 @@ {% load render_table from django_tables2 %} {% block title %} Find Players {% endblock %} {% block stylesheets %} {{ block.super }} {% endblock stylesheets %} + +{% block header_title %} +
+
+

+ AGAGD +

+
+ +
+

Search Results for {{ query }}

+
+
+{% endblock header_title %} + +{% block header %} +
+
+ + {% include "agagd_core/fetch_player_form.html" %} +
+
+ +
+{% endblock header %} + {% block content %} {{ block.super }} -

Search Results

-{% include "agagd_core/_search_pl_form.html" %} -
{% if member_table %} {% render_table member_table %} {% else %} -

No members found

+

No members found. Please try another member search to locate a member by there name or member id.

{% endif %} {% endblock %} diff --git a/agagd/templates/agagd_core/tournament_list.html b/agagd/templates/agagd_core/tournament_list.html index 9431719c..48c3a155 100644 --- a/agagd/templates/agagd_core/tournament_list.html +++ b/agagd/templates/agagd_core/tournament_list.html @@ -1,18 +1,30 @@ {% extends "base.html" %} +{% load staticfiles %} {% load render_table from django_tables2 %} +{% block title %} AGAGD - Tournaments {% endblock %} +{% block stylesheets %} {{ block.super }} {% endblock stylesheets %} + +{% block header_title %} +
+

+ AGAGD +

+

Tournaments

+
+{% endblock header_title %} + +{% block header %} +
+
+ {% include "agagd_core/_search_tournaments.html" %} +
+
+ +
+{% endblock header %} + {% block content %} -

- - - - - -

-

- + {{ block.super }} + {% render_table tournament_table %} {% endblock %} diff --git a/agagd/templates/agagd_core/tourney.html b/agagd/templates/agagd_core/tourney.html index 89361915..a4c00218 100644 --- a/agagd/templates/agagd_core/tourney.html +++ b/agagd/templates/agagd_core/tourney.html @@ -3,17 +3,29 @@ {% load staticfiles %} {% load render_table from django_tables2 %} -{% block title %} Tournament Detail for ... {% endblock %} +{% block title %} Tournament Detail for {{ tournament.description }} {% endblock %} {% block stylesheets %} {{ block.super }} {% endblock stylesheets %} + +{% block header_title %} +
+

+ AGAGD +

+ + {% if tournament.description %} +

Tournament: {{ tournament.description }}

+ {% else %} +

Tournament: {{ tournament.tournament_code }}

+ {% endif %} + +

Held {{ tournament.tournament_date }}, there were {{ tournament.total_players }} players in {{ tournament.rounds }} rounds

+
+{% endblock header_title %} + + {% block content %} {{ block.super }} - {% if tournament.description %} -

Tournament: {{ tournament.description }}

- {% else %} -

Tournament: {{ tournament.tournament_code }}

- {% endif %} -

Held {{ tournament.tournament_date }}, there were {{ tournament.total_players }} players in {{ tournament.rounds }} rounds

Recreated Wall List

 {{ tournament.wall_list }} 
diff --git a/agagd/templates/base.html b/agagd/templates/base.html index c54cd873..75ecb129 100644 --- a/agagd/templates/base.html +++ b/agagd/templates/base.html @@ -2,34 +2,46 @@ {% load staticfiles %} - {% block title %} AGA Games Database {% endblock title %} - - {% block stylesheets %} - - - - {% endblock stylesheets %} - {% block js_includes %} - - - {% endblock %} - - -
- -
- {% block content %} - {% endblock content %} -
- -
- + {% block title %} AGA Games Database {% endblock title %} + {% block stylesheets %} + + + + {% endblock stylesheets %} + {% block js_includes %} + + + {% endblock %} + + + + + + + +
+ +
+ {% block content %} {% endblock content %} +
+ +
+ diff --git a/agagd/templates/static_pages/information.html b/agagd/templates/static_pages/information.html index b9c3ce5f..d1e2cc65 100644 --- a/agagd/templates/static_pages/information.html +++ b/agagd/templates/static_pages/information.html @@ -2,13 +2,21 @@ {% load staticfiles %} {% block title %}Ratings Information{% endblock %} {% block stylesheets %} {{ block.super }} {% endblock stylesheets %} + +{% block header_title %} +
+

+ AGAGD +

+ +

Ratings Information

+
+{% endblock header_title %} + {% block content %} {{ block.super }}
- -

Ratings Information

-

The AGA Rating System, unlike some other systems, does not merely tally results and award or remove fixed numbers of points from the player's total. Based on advanced statistical procedures, it looks at results of many events simultaneously, using the results to figure out how likely each player was to defeat the other. Players are ranked and ordered according to these calculations.

The AGA rates serious games, mainly from face-to-face tournament and club play. The basic qualifications for rated games are probably easier to meet than you might think,and the AGA encourages you to submit your game results. Learn how to submit game results to the rating system. diff --git a/agagd/templates/static_pages/qualifications.html b/agagd/templates/static_pages/qualifications.html index b0eeaf7e..416a0ea7 100644 --- a/agagd/templates/static_pages/qualifications.html +++ b/agagd/templates/static_pages/qualifications.html @@ -2,13 +2,21 @@ {% load staticfiles %} {% block title %}Qualifications for Rated Games{% endblock %} {% block stylesheets %} {{ block.super }} {% endblock stylesheets %} + +{% block header_title %} +

+

+ AGAGD +

+ +

Qualifications for Rated Games

+
+{% endblock header_title %} + {% block content %} {{ block.super }}
- -

Qualifications for Rated Games

-

The AGA accepts game results for rating from recognized clubs and tournament organizers.

Qualifications for Rated Games

diff --git a/requirements.txt b/requirements.txt index 1276ddc8..c97b0673 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,5 @@ django-tables2==1.15.0 mysqlclient==1.4.6 requests==2.22.0 six==1.4.1 -simplejson==3.17.0 wsgiref==0.1.2 yolk==0.4.3