diff --git a/Client/OpenBench.py b/Client/OpenBench.py index 6d4c0cb..792e490 100644 --- a/Client/OpenBench.py +++ b/Client/OpenBench.py @@ -296,7 +296,6 @@ def reportResults(data, wins, losses, draws, crashes, timeloss): 'timeloss' : timeloss, 'username' : USERNAME, 'password' : PASSWORD, - 'profileid' : data['profile']['id'], 'machineid' : data['machine']['id'], 'resultid' : data['result']['id'], 'testid' : data['test']['id']} diff --git a/OpenBench/models.py b/OpenBench/models.py index 49f4503..601f628 100644 --- a/OpenBench/models.py +++ b/OpenBench/models.py @@ -26,7 +26,7 @@ class Engine(Model): class Profile(Model): - user = OneToOneField(User, on_delete=CASCADE) + user = ForeignKey(User, PROTECT, related_name='user') games = IntegerField(default=0) tests = IntegerField(default=0) repo = CharField(max_length=256, blank=True) diff --git a/OpenBench/utils.py b/OpenBench/utils.py index 2f6520c..6b92429 100644 --- a/OpenBench/utils.py +++ b/OpenBench/utils.py @@ -169,7 +169,6 @@ def workloadDictionary(machine, result, test): # specification for both engines. Group the dev and base # options with the coressponding engine, for easy usage return { - 'profile' : { 'id' : profile.id }, 'machine' : { 'id' : machine.id, }, 'result' : { 'id' : result.id, }, 'test' : { @@ -214,7 +213,6 @@ def update(request): games = wins + losses + draws # Parse the various IDs sent back - profileid = int(request.POST['profileid']) machineid = int(request.POST['machineid']) resultid = int(request.POST['resultid']) testid = int(request.POST['testid']) @@ -232,7 +230,7 @@ def update(request): finished = passed or failed # Update total # of games played for the User - Profile.objects.filter(id=profileid).update(games=F('games') + games) + Profile.objects.filter(user=user).update(games=F('games') + games) # Just force an update to Machine.update Machine.objects.filter(id=machineid).update()