indexes
This commit is contained in:
parent
39a61ba1d6
commit
a09ec5234a
49
Main/migrations/0012_auto_20220120_0047.py
Normal file
49
Main/migrations/0012_auto_20220120_0047.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# Generated by Django 3.2.4 on 2022-01-19 21:47
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('Main', '0011_remove_userinfo_token'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='extrafile',
|
||||||
|
index=models.Index(fields=['task'], name='Main_extraf_task_id_423651_idx'),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='friendship',
|
||||||
|
index=models.Index(fields=['from_user'], name='Main_friend_from_us_0923c9_idx'),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='friendship',
|
||||||
|
index=models.Index(fields=['to_user'], name='Main_friend_to_user_389a97_idx'),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='message',
|
||||||
|
index=models.Index(fields=['chat', '-time_sent'], name='Main_messag_chat_id_494037_idx'),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='progress',
|
||||||
|
index=models.Index(fields=['user', 'task'], name='Main_progre_user_id_3ed604_idx'),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='settask',
|
||||||
|
index=models.Index(fields=['set'], name='Main_settas_set_id_046a3e_idx'),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='solution',
|
||||||
|
index=models.Index(fields=['task', 'user', '-time_sent'], name='Main_soluti_task_id_0d9c15_idx'),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='solution',
|
||||||
|
index=models.Index(fields=['task', '-time_sent'], name='Main_soluti_task_id_878836_idx'),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='solutionfile',
|
||||||
|
index=models.Index(fields=['solution'], name='Main_soluti_solutio_cebd76_idx'),
|
||||||
|
),
|
||||||
|
]
|
@ -13,6 +13,11 @@ class ExtraFile(FileStorageMixin, models.Model):
|
|||||||
test_number = models.IntegerField(null=True)
|
test_number = models.IntegerField(null=True)
|
||||||
fs_id = models.IntegerField(null=True)
|
fs_id = models.IntegerField(null=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=['task'])
|
||||||
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def can_be_sample(self):
|
def can_be_sample(self):
|
||||||
return (
|
return (
|
||||||
|
@ -6,3 +6,9 @@ class Friendship(models.Model):
|
|||||||
from_user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="from_friendship")
|
from_user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="from_friendship")
|
||||||
to_user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="to_friendship")
|
to_user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="to_friendship")
|
||||||
verified = models.BooleanField(default=False)
|
verified = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=['from_user']),
|
||||||
|
models.Index(fields=['to_user'])
|
||||||
|
]
|
||||||
|
@ -11,3 +11,8 @@ class Message(models.Model):
|
|||||||
text = models.TextField()
|
text = models.TextField()
|
||||||
read = models.BooleanField(default=False)
|
read = models.BooleanField(default=False)
|
||||||
time_sent = models.DateTimeField(default=timezone.now)
|
time_sent = models.DateTimeField(default=timezone.now)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=['chat', '-time_sent'])
|
||||||
|
]
|
||||||
|
@ -15,6 +15,11 @@ class Progress(models.Model):
|
|||||||
score = models.IntegerField(default=0)
|
score = models.IntegerField(default=0)
|
||||||
finished = models.BooleanField(default=False)
|
finished = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=['user', 'task'])
|
||||||
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def time(self):
|
def time(self):
|
||||||
if not self.finished:
|
if not self.finished:
|
||||||
|
@ -8,3 +8,8 @@ class SetTask(models.Model):
|
|||||||
set = models.ForeignKey(Set, on_delete=models.CASCADE, related_name="settasks")
|
set = models.ForeignKey(Set, on_delete=models.CASCADE, related_name="settasks")
|
||||||
task = models.ForeignKey(Task, on_delete=models.CASCADE, related_name="settasks")
|
task = models.ForeignKey(Task, on_delete=models.CASCADE, related_name="settasks")
|
||||||
name = models.CharField(max_length=2)
|
name = models.CharField(max_length=2)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=['set'])
|
||||||
|
]
|
||||||
|
@ -21,6 +21,12 @@ class Solution(models.Model):
|
|||||||
result = models.TextField(default=CONSTS["in_queue_status"])
|
result = models.TextField(default=CONSTS["in_queue_status"])
|
||||||
test = models.IntegerField(default=None, null=True)
|
test = models.IntegerField(default=None, null=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=['task', 'user', '-time_sent']),
|
||||||
|
models.Index(fields=['task', '-time_sent'])
|
||||||
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def language(self):
|
def language(self):
|
||||||
return languages[self.language_id]
|
return languages[self.language_id]
|
||||||
|
@ -7,3 +7,8 @@ class SolutionFile(FileStorageMixin, models.Model):
|
|||||||
path = models.TextField()
|
path = models.TextField()
|
||||||
fs_id = models.IntegerField()
|
fs_id = models.IntegerField()
|
||||||
solution = models.ForeignKey("Solution", on_delete=models.CASCADE)
|
solution = models.ForeignKey("Solution", on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=['solution'])
|
||||||
|
]
|
||||||
|
7
Main/views/SetView.py
Normal file
7
Main/views/SetView.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
from SprintLib.BaseView import BaseView
|
||||||
|
|
||||||
|
|
||||||
|
class SetView(BaseView):
|
||||||
|
required_login = True
|
||||||
|
endpoint = 'set'
|
||||||
|
view_file = 'set.html'
|
@ -18,3 +18,4 @@ from Main.views.SolutionsView import SolutionsView
|
|||||||
from Main.views.ChatView import ChatView
|
from Main.views.ChatView import ChatView
|
||||||
from Main.views.ChatWithView import ChatWithView
|
from Main.views.ChatWithView import ChatWithView
|
||||||
from Main.views.MessagesView import MessagesView
|
from Main.views.MessagesView import MessagesView
|
||||||
|
from Main.views.SetView import SetView
|
||||||
|
Loading…
Reference in New Issue
Block a user