table
This commit is contained in:
@@ -8,7 +8,7 @@ from django.db.models import JSONField
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
from Main.models import Set
|
||||
from Main.models import Set, SetTask
|
||||
from Main.models.solution_file import SolutionFile
|
||||
from Main.models.task import Task
|
||||
from Sprint.settings import CONSTS
|
||||
@@ -32,6 +32,10 @@ class Solution(models.Model):
|
||||
models.Index(fields=['set', '-time_sent']),
|
||||
]
|
||||
|
||||
@cached_property
|
||||
def settask(self):
|
||||
return SetTask.objects.filter(set=self.set, task=self.task).first()
|
||||
|
||||
@property
|
||||
def percentage_done(self):
|
||||
if self.test is None:
|
||||
|
@@ -29,6 +29,9 @@ class UserInfo(models.Model):
|
||||
verified = models.BooleanField(default=False)
|
||||
teacher = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return self.surname + ' ' + self.name
|
||||
|
||||
@property
|
||||
def tasks_solved(self):
|
||||
fltr = Task.objects.filter(solution__result=CONSTS["ok_status"], solution__user=self.user).distinct()
|
||||
|
Reference in New Issue
Block a user