From 99827c6385d5a298acfe27a4b26e015d40637a95 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Fri, 27 Jan 2017 00:26:46 +0100 Subject: [PATCH] Recheck QSO functionality --- TODO | 2 +- contest/models.py | 1 - contest/urls.py | 1 + contest/views.py | 16 ++++++++++++++++ templates/contest/checkAllQSOs.html | 28 ++++++++++++++++++++++++++++ templates/contest/registerRefs.html | 2 +- 6 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 templates/contest/checkAllQSOs.html diff --git a/TODO b/TODO index 42059af..99b664d 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ - calculate "claimed points" - - link/funktion um qsos erneut gegeneinander checken zu lassen - listviews mit pagination evaluieren - registered datum, name und "genauer standort" für benutzer und shadowbenutzer? @@ -26,6 +25,7 @@ - ensure QSOs are logged in UTC (they currently are, but why?) - rearrange login index: contest content rüberziehen; exchange registration nach rechts in der nav - cbr parser zum hochladen + - link/funktion um qsos erneut gegeneinander checken zu lassen Glaube nich, dass ich das mache - call dupe validation könnte ins model wandern diff --git a/contest/models.py b/contest/models.py index 75312c3..ed8dd71 100644 --- a/contest/models.py +++ b/contest/models.py @@ -147,7 +147,6 @@ class QSO(models.Model): self.cfmdQSO.cfmdQSO = None self.cfmdQSO = None - self.cfmdQSO = None if self.ref and self.callRef and self.callRef.ref and not self.cfmdQSO: # look for a matching line q = QSO.objects.filter( diff --git a/contest/urls.py b/contest/urls.py index aa7c405..b83d4a3 100644 --- a/contest/urls.py +++ b/contest/urls.py @@ -31,4 +31,5 @@ urlpatterns = [ url(r'^log/edit/(?P\d+)/$', contest_views.logEdit, name='logEdit'), url(r'^log/delete/(?P\d+)/$', contest_views.logDelete, name='logDelete'), url(r'^uploadcbr/$', uploadCBR, name='uploadCBR'), + url(r'^regref/recheckqsos//$', contest_views.recheckAllQSOs, name='recheckAllQSOs'), ] diff --git a/contest/views.py b/contest/views.py index f46983b..07f6564 100644 --- a/contest/views.py +++ b/contest/views.py @@ -141,6 +141,22 @@ def getPage(paginator, pageNo): except EmptyPage: return paginator.page(paginator.num_pages) + +@staff_member_required +def recheckAllQSOs(request): + if request.method == "POST": + cnt = 0 + for qso in QSO.objects.all(): + if qso.checkQSOData(): + print(qso) + qso.save() + cnt += 1 + + messages.success(request, "Allo QSO have been checked against each other (%d QSOs modified)" % (cnt,)) + return HttpResponseRedirect(reverse("contest:registerRefs")) + + return render(request, "contest/checkAllQSOs.html", {}) + @staff_member_required def viewUserQSOs(request, uid, page=1): user = get_object_or_404(User, id=uid) diff --git a/templates/contest/checkAllQSOs.html b/templates/contest/checkAllQSOs.html new file mode 100644 index 0000000..a1c651d --- /dev/null +++ b/templates/contest/checkAllQSOs.html @@ -0,0 +1,28 @@ +{% extends "base.html" %} + +{% load crispy_forms_tags %} + +{% block content %} +
+
+
+
Check all QSOs?
+
+

+ You have the option to let the system recheck all QSOs if + they can find another matching QSO, also to re-verify exchanges + and callsigns. +

+

+ This might take some time! +

+
+ {% csrf_token %} + +
+
+
+
+
+{% endblock %} + diff --git a/templates/contest/registerRefs.html b/templates/contest/registerRefs.html index 63788f7..4ffda5c 100644 --- a/templates/contest/registerRefs.html +++ b/templates/contest/registerRefs.html @@ -10,7 +10,7 @@
Contest Stations
- Here is a Table with all OMs/YLs in the contest! + Here is a Table with all OMs/YLs in the contest! If you want you can recheck for cfmd QSOs here.