Browse code

add score submission counter

devnewton authored on 14/09/2012 at 20:25:56
Showing 3 changed files
... ...
@@ -6,6 +6,7 @@ class Game(models.Model):
6 6
     slug = models.SlugField(max_length=80, unique=True)
7 7
     name = models.CharField(max_length=80)
8 8
     description = models.TextField()
9
+    nbScoreSubmitted = models.PositiveIntegerField(default=0);
9 10
     def __unicode__(self):
10 11
         return self.name
11 12
     @models.permalink
... ...
@@ -10,6 +10,7 @@
10 10
             </tr>
11 11
         {% endfor %}
12 12
     </table>
13
+    <p>{{ object.nbScoreSubmitted  }} scores submitted.</p>
13 14
     
14 15
 {% endblock %}
15 16
 
... ...
@@ -39,6 +39,8 @@ def score(request):
39 39
     if not isNewScore:
40 40
         score.score = max( int( request.REQUEST['score'] ), int( score.score ) )
41 41
         score.save()
42
+    level.game.nbScoreSubmitted += 1
43
+    level.game.save()
42 44
     #cleanup
43 45
     level.cleanup()
44 46
     Player.cleanup()