Added another js callback for when a level is rated
This commit is contained in:
parent
2f7d028086
commit
3d0f4e4353
@ -1,5 +1,3 @@
|
|||||||
import math
|
|
||||||
|
|
||||||
from django.core.validators import MinValueValidator, MaxValueValidator
|
from django.core.validators import MinValueValidator, MaxValueValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Avg
|
from django.db.models import Avg
|
||||||
@ -42,7 +40,7 @@ class Level(models.Model):
|
|||||||
@property
|
@property
|
||||||
def stars(self):
|
def stars(self):
|
||||||
result = list(self.bloonsa_level_ratings.aggregate(Avg("rating")).values())[0]
|
result = list(self.bloonsa_level_ratings.aggregate(Avg("rating")).values())[0]
|
||||||
return 0 if result is None else math.ceil(result)
|
return 0 if result is None else round(result)
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|||||||
@ -8,6 +8,12 @@ function bloonsa_level_completed(level_id) {
|
|||||||
bloonsa_update_data(level_id)
|
bloonsa_update_data(level_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bloonsa_rated_level_success(level_id) {
|
||||||
|
console.log("call to bloonsa_rated_level_success");
|
||||||
|
bloonsa_update_data(level_id)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function bloonsa_update_data(level_id) {
|
function bloonsa_update_data(level_id) {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
console.log("call to update_data");
|
console.log("call to update_data");
|
||||||
|
|||||||
Binary file not shown.
13
dev/debugging/double_js_bug_as3.txt
Normal file
13
dev/debugging/double_js_bug_as3.txt
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
bug triggers:
|
||||||
|
- RESET button in-game: _parent._parent.popgame.Init();
|
||||||
|
- GO RANDOM button in-game: _parent._parent.popgame.GetRandomLevel(0);
|
||||||
|
- PLAY RANDOM button post-game: _parent._parent.popgame.GetRandomLevel(0);
|
||||||
|
- PLAY RANDOM button mainmenu: _parent.popgame.GetRandomLevel(0);
|
||||||
|
|
||||||
|
doesn't trigger:
|
||||||
|
- REPLAY LEVEL button post-game:
|
||||||
|
_parent.dest = "play";
|
||||||
|
_parent.gotoAndPlay("drawOff");
|
||||||
|
- PLAY button from level-id in mainmenu:
|
||||||
|
_parent._parent.popgame.curLevel = loadthis_txt.text;
|
||||||
|
_parent._parent.gotoAndPlay("play");
|
||||||
Loading…
Reference in New Issue
Block a user