-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodels.py
68 lines (52 loc) · 2.1 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
"""
Codeforces problems. Fetch locally.
Variables are named accordingly to the api.
"""
class Problem(models.Model):
contest_id = models.IntegerField(default=1)
name = models.CharField(max_length=200, default="codeforces")
rating = models.IntegerField(default=1500)
index = models.CharField(max_length=4, default="A")
def __str__(self):
return (
str(self.contest_id)
+ self.index
+ ": "
+ self.name
+ ", "
+ str(self.rating)
)
"""
Profile hereby inherits the django user.
handle = codeforces handle
rating_progress = python list stored in string type through 'repr' method, later parse by eval
"""
class Profile(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, default=None)
handle = models.CharField(max_length=40, default="Mike")
registration_date = models.DateField(auto_now_add=True)
rating_progress = models.CharField(max_length=1000, default="[]")
virtual_rating = models.IntegerField(default=1400)
in_progress = models.BooleanField(default=False)
current_problem = models.CharField(max_length=20, default="Unselected")
deadline = models.DateTimeField(auto_now_add=True)
history = models.CharField(max_length=1000, default="[]")
msg = models.IntegerField(default=0)
def __str__(self):
return self.handle + "|" + self.rating_progress
class AuthQuery(models.Model):
handle = models.CharField(max_length=40, default="mike")
password = models.CharField(max_length=128, default="bruh")
date = models.DateTimeField(auto_now_add=True)
rating = models.IntegerField(default=1400)
contest_id = models.IntegerField(default=1400)
index = models.CharField(max_length=4, default="A")
valid = models.BooleanField(default=False)
"""
TODO: Fix this with async / celery later
"""
class FetchData(models.Model):
last_update = models.DateTimeField(auto_now_add=True)