add heatmap
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# Generated by Django 5.2.3 on 2025-09-25 07:03
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('contest', '0001_initial'),
|
||||
('problem', '0001_initial'),
|
||||
('submission', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddIndex(
|
||||
model_name='submission',
|
||||
index=models.Index(fields=['user_id', 'create_time'], name='user_create_time_idx'),
|
||||
),
|
||||
]
|
||||
@@ -41,7 +41,12 @@ class Submission(models.Model):
|
||||
ip = models.TextField(null=True)
|
||||
|
||||
def check_user_permission(self, user, check_share=True):
|
||||
if self.user_id == user.id or user.is_super_admin() or user.can_mgmt_all_problem() or self.problem.created_by_id == user.id:
|
||||
if (
|
||||
self.user_id == user.id
|
||||
or user.is_super_admin()
|
||||
or user.can_mgmt_all_problem()
|
||||
or self.problem.created_by_id == user.id
|
||||
):
|
||||
return True
|
||||
|
||||
if check_share:
|
||||
@@ -54,6 +59,11 @@ class Submission(models.Model):
|
||||
class Meta:
|
||||
db_table = "submission"
|
||||
ordering = ("-create_time",)
|
||||
indexes = [
|
||||
models.Index(
|
||||
fields=["user_id", "create_time"], name="user_create_time_idx"
|
||||
),
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return self.id
|
||||
|
||||
Reference in New Issue
Block a user