progress bar

This commit is contained in:
Egor Matveev
2022-02-23 23:27:35 +03:00
parent 4e9c195d9d
commit 65ee7117cb
7 changed files with 30 additions and 9 deletions

View File

@@ -30,6 +30,12 @@ class Solution(models.Model):
models.Index(fields=['set', '-time_sent']),
]
@property
def percentage_done(self):
if self.test is None:
return 0
return self.test * 100 // self.task.tests_count
@property
def language(self):
return languages[self.language_id]

View File

@@ -28,6 +28,10 @@ class Task(models.Model):
def tests(self):
return ExtraFile.objects.filter(task=self, is_test=True).order_by('filename')
@property
def tests_count(self):
return len(self.tests) // 2
@property
def samples(self):
data = []