From: Jess Date: Thu, 28 Aug 2014 20:08:16 +0000 (+0200) Subject: remove all useless .pyc files X-Git-Url: https://git.yukkurigames.com/?p=mlpccg-meta.git;a=commitdiff_plain;h=247faccd70eea33b856c3aac471be3d411b8be80 remove all useless .pyc files --- diff --git a/data/db.sqlite3 b/data/db.sqlite3 index 40ec1ed..1638b65 100644 Binary files a/data/db.sqlite3 and b/data/db.sqlite3 differ diff --git a/db.sqlite3 b/db.sqlite3 deleted file mode 100644 index d711bb8..0000000 Binary files a/db.sqlite3 and /dev/null differ diff --git a/meta/__init__.pyc b/meta/__init__.pyc deleted file mode 100644 index 20b49d6..0000000 Binary files a/meta/__init__.pyc and /dev/null differ diff --git a/meta/admin.pyc b/meta/admin.pyc deleted file mode 100644 index 4bfd4dd..0000000 Binary files a/meta/admin.pyc and /dev/null differ diff --git a/meta/management/__init__.pyc b/meta/management/__init__.pyc deleted file mode 100644 index 859abf5..0000000 Binary files a/meta/management/__init__.pyc and /dev/null differ diff --git a/meta/management/commands/__init__.pyc b/meta/management/commands/__init__.pyc deleted file mode 100644 index a39dec7..0000000 Binary files a/meta/management/commands/__init__.pyc and /dev/null differ diff --git a/meta/management/commands/csvimport.pyc b/meta/management/commands/csvimport.pyc deleted file mode 100644 index e920111..0000000 Binary files a/meta/management/commands/csvimport.pyc and /dev/null differ diff --git a/meta/models.py b/meta/models.py index 7ba7946..3eb55fb 100644 --- a/meta/models.py +++ b/meta/models.py @@ -10,6 +10,7 @@ class DeckListModel(models.Model): class TournamentModel(models.Model): name = models.CharField(max_length=200) date = models.DateField() + verified = models.BooleanField() def __unicode__(self): return '%s (%s)' % (self.name, self.date.strftime('%Y-%m-%d')) diff --git a/meta/models.pyc b/meta/models.pyc deleted file mode 100644 index bcc1dae..0000000 Binary files a/meta/models.pyc and /dev/null differ diff --git a/meta/static/css/main.css b/meta/static/css/main.css index b4765a1..23f4461 100644 --- a/meta/static/css/main.css +++ b/meta/static/css/main.css @@ -1,11 +1,40 @@ - - -/* ========================================================================== - Author's custom styles - ========================================================================== */ - - - - - - +.tt-dropdown-menu { + width: 422px; + margin-top: 12px; + padding: 8px 0; + background-color: #fff; + border: 1px solid# ccc; + border: 1px solid rgba(0, 0, 0, 0.2); + -webkit-border-radius: 8px; + moz-border-radius: 8px; + border-radius: 8px; + -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2); + -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, .2); + box-shadow: 0 5px 10px rgba(0, 0, 0, .2); +} + +.tt-query { + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} + +.tt-hint { + color: #999 +} + +.tt-suggestion { + padding: 3px 20px; + /* font-size: 18px; */ + /* line-height: 24px; */ +} + +.tt-suggestion.tt-cursor { + color: #fff; + background-color: #0097cf; + +} + +.tt-suggestion p { + margin: 0; +} \ No newline at end of file diff --git a/meta/static/js/main.js b/meta/static/js/main.js index a2614b3..8f2924a 100644 --- a/meta/static/js/main.js +++ b/meta/static/js/main.js @@ -5,16 +5,18 @@ function rateDeck() { } var tournaments = new Bloodhound({ - datumTokenizer: Bloodhound.tokenizers.obj.nonword('name'), - queryTokenizer: Bloodhound.tokenizers.nonword, - prefetch: '/meta/tournaments' + datumTokenizer: Bloodhound.tokenizers.obj.nonword('name'), + queryTokenizer: Bloodhound.tokenizers.nonword, + prefetch: '/meta/tournaments' }); +tournaments.clearPrefetchCache() tournaments.initialize(); $(document).ready(function() { - $('.typeahead-tournaments').typeahead(null, { - name: 'tournaments', + $('.typeahead-tournaments').typeahead({ + highlight: true + }, { displayKey: 'name', source: tournaments.ttAdapter() }); diff --git a/meta/templates/base.html b/meta/templates/base.html index 240be55..0b5a25d 100644 --- a/meta/templates/base.html +++ b/meta/templates/base.html @@ -11,15 +11,16 @@ + + - - + @@ -35,7 +36,7 @@ - meta is magic + meta is magic @@ -55,8 +56,11 @@
{% block content %}{% endblock %} -
+
+ {% block jumbotron_end %}
{% endblock %} + +

© Yukkuri Games, 2014

diff --git a/meta/templates/index.html b/meta/templates/index.html index e4f9e6f..c307f26 100644 --- a/meta/templates/index.html +++ b/meta/templates/index.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% load meta_extras %} {% block jumbotron %}
@@ -11,7 +12,7 @@ {% csrf_token %}
- +
@@ -27,19 +28,19 @@

Very fuzzy data, based on past tournaments. The more the deck was played in tournaments, the more accurate this is.

- + {% load humanize %} {% for avg, label, decks in ranking %} - + @@ -61,7 +62,7 @@ {% for t in tournaments %} - +
Archetype ID Average placement Example decks
{{ label }} {{ avg|ordinal }}
{{ t.tournament.date }}{{ t.tournament.name }}{{ t.tournament.name }} {% for d in t.decklists|slice:":8" %} {{ d.name }} ({{ d.description }})
@@ -74,3 +75,22 @@ {% endblock %} + +{% block jumbotron_end %} +
+
+

Is your deck not in the list?

+

Paste your ponyhead.com URL here and help make this site better!

+

+

+ {% csrf_token %} +
+ + + +
+
+

+
+
+{% endblock %} diff --git a/meta/templates/rate.html b/meta/templates/rate.html index 939b202..196c59e 100644 --- a/meta/templates/rate.html +++ b/meta/templates/rate.html @@ -7,13 +7,13 @@

{{ deck.description }}

Decks similiar to yours and their placement in past tournaments:

+
- - + {% for deck, record in similiar reversed %} @@ -25,15 +25,17 @@ {% endfor %} - + - {% csrf_token %} - + - - + + -
Deck Placement TournamentDateNotesDate
Played this deck in a tournament? Add your result here! + Played this deck in a tournament? Add your result here! +

This helps you and us to get a better overview over the meta-game.

+
- @@ -44,12 +46,12 @@
+
diff --git a/meta/templates/tournament_detail.html b/meta/templates/tournament_detail.html new file mode 100644 index 0000000..f2d3ffc --- /dev/null +++ b/meta/templates/tournament_detail.html @@ -0,0 +1,27 @@ +{% extends "base.html" %} +{% load humanize %} + +{% block content %} + +
+
+

{{ tournament.name }}

+

{{ tournament.date }} + + + + + + {% for placement, decklist, verified in records %} + + + + + + + {% endfor %} +
PlacementDeck
{{ placement|ordinal }}{{ decklist.name }}{{ decklist.description }}{% if not verified %}user-submitted{% endif %}
+

+
+ +{% endblock %} diff --git a/meta/templatetags/__init__.py b/meta/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/meta/templatetags/meta_extras.py b/meta/templatetags/meta_extras.py new file mode 100644 index 0000000..6f56fd0 --- /dev/null +++ b/meta/templatetags/meta_extras.py @@ -0,0 +1,8 @@ +from django import template + +register = template.Library() + +@register.filter +def deckicon(decklist): + #mane, aspects = decklist.aspects + return decklist.description diff --git a/meta/views.py b/meta/views.py index a1cf06b..0f71d00 100644 --- a/meta/views.py +++ b/meta/views.py @@ -1,10 +1,10 @@ -import datetime +from datetime import datetime import difflib import json -from django.shortcuts import render +from django.shortcuts import render, get_object_or_404 from django.template import RequestContext from django.http import HttpResponse -from meta.models import TournamentModel, RecordModel +from meta.models import TournamentModel, RecordModel, DeckListModel from mlpccg.CardDb import CARDDB from mlpccg.DeckList import DeckList from mlpccg.Clustering import Clustering @@ -24,15 +24,47 @@ def index(request): return render(request, 'index.html', { 'ranking': ranking, - 'tournaments': tournament_data}, - context_instance=RequestContext(request)) + 'tournaments': tournament_data + }, context_instance=RequestContext(request)) def tournaments(request): - return HttpResponse(json.dumps([{'name': t.name} for t in TournamentModel.objects.all()]), content_type='application/json') + return HttpResponse(json.dumps([{'name': t.name, 'id': t.id} for t in TournamentModel.objects.all()]), + content_type='application/json') + +def tournaments_detail(request, tournament_id): + tournament = get_object_or_404(TournamentModel, pk=tournament_id) + records = [(record.placement, + DeckList(name=record.decklist.name, url=record.decklist.url), + record.verified) for record in tournament.recordmodel_set.all()] + + records.sort(key=lambda x: x[0]) + + return render(request, 'tournament_detail.html', { + 'records': records, + 'tournament': tournament}) def rate(request): decklist = DeckList(url=request.POST['url']) + if request.POST.get('d_name') and request.POST.get('t_date') and request.POST.get('t_name') and request.POST.get('t_placement'): + try: + tournament = TournamentModel.objects.get(name__iexact=request.POST['t_name']) + + except TournamentModel.DoesNotExist: + tournament = TournamentModel(name=request.POST['t_name'], + date=datetime.strptime(request.POST['t_date'], '%Y-%m-%d'), + verified=False) + tournament.save() + + decklist_model = DeckListModel(name=request.POST['d_name'], url=request.POST['url']) + decklist_model.save() + + record = RecordModel(placement=request.POST['t_placement'], + tournament=tournament, + decklist=decklist_model, + verified=False) + record.save() + records = RecordModel.objects.all() placements = [{'decklist': DeckList(name=record.decklist.name, url=record.decklist.url), 'placement': record.placement, 'record': record} for record in records if record.decklist.url] clustering = Clustering(records=placements) @@ -46,4 +78,5 @@ def rate(request): return render(request, 'rate.html', { 'deck': decklist, - 'similiar': similiar}, context_instance=RequestContext(request)) + 'similiar': similiar + }, context_instance=RequestContext(request)) diff --git a/meta/views.pyc b/meta/views.pyc deleted file mode 100644 index cde0787..0000000 Binary files a/meta/views.pyc and /dev/null differ diff --git a/mlpccg-web/__init__.pyc b/mlpccg-web/__init__.pyc deleted file mode 100644 index 978e32d..0000000 Binary files a/mlpccg-web/__init__.pyc and /dev/null differ diff --git a/mlpccg-web/settings.py b/mlpccg-web/settings.py index 1da064d..5f311eb 100644 --- a/mlpccg-web/settings.py +++ b/mlpccg-web/settings.py @@ -60,7 +60,7 @@ WSGI_APPLICATION = 'mlpccg-web.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'NAME': os.path.join(BASE_DIR, 'data/db.sqlite3'), } } diff --git a/mlpccg-web/settings.pyc b/mlpccg-web/settings.pyc deleted file mode 100644 index 522ed8e..0000000 Binary files a/mlpccg-web/settings.pyc and /dev/null differ diff --git a/mlpccg-web/urls.py b/mlpccg-web/urls.py index 2c05e73..f00f3e8 100644 --- a/mlpccg-web/urls.py +++ b/mlpccg-web/urls.py @@ -9,5 +9,6 @@ urlpatterns = patterns( url(r'^$', 'meta.views.index'), url(r'^meta/$', 'meta.views.index'), url(r'^meta/rate$', 'meta.views.rate'), - url(r'^meta/tournaments', 'meta.views.tournaments') + url(r'^meta/tournaments$', 'meta.views.tournaments'), + url(r'^meta/tournaments/(?P\d+)$', 'meta.views.tournaments_detail') ) diff --git a/mlpccg-web/urls.pyc b/mlpccg-web/urls.pyc deleted file mode 100644 index ae1775f..0000000 Binary files a/mlpccg-web/urls.pyc and /dev/null differ diff --git a/mlpccg-web/wsgi.pyc b/mlpccg-web/wsgi.pyc deleted file mode 100644 index 7def173..0000000 Binary files a/mlpccg-web/wsgi.pyc and /dev/null differ diff --git a/mlpccg/DeckList.py b/mlpccg/DeckList.py index 5ff46bf..ec57645 100644 --- a/mlpccg/DeckList.py +++ b/mlpccg/DeckList.py @@ -57,7 +57,7 @@ class DeckList: def ponyhead_link(self): cards = defaultdict(int) for card in self.cards: - cards[card['id'].replace('f', 'F')] += 1 + cards[card['id'].replace('pf', 'PF').replace('f', 'F')] += 1 cards = ['%sx%d' % (id, amount) for id, amount in cards.iteritems()]