mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 01:37:11 +00:00
Merge branch 'master' of gitlab.prodcontest.ru:team-15/project
This commit is contained in:
+41
-1
@@ -1 +1,41 @@
|
||||
# DataRush Docs
|
||||
# Website
|
||||
|
||||
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
|
||||
|
||||
### Installation
|
||||
|
||||
```
|
||||
$ yarn
|
||||
```
|
||||
|
||||
### Local Development
|
||||
|
||||
```
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
|
||||
|
||||
### Build
|
||||
|
||||
```
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
||||
|
||||
### Deployment
|
||||
|
||||
Using SSH:
|
||||
|
||||
```
|
||||
$ USE_SSH=true yarn deploy
|
||||
```
|
||||
|
||||
Not using SSH:
|
||||
|
||||
```
|
||||
$ GIT_USER=<Your GitHub username> yarn deploy
|
||||
```
|
||||
|
||||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
|
||||
|
||||
@@ -8,6 +8,8 @@ from apps.competition.models import Competition, State
|
||||
|
||||
class CompetitionOut(ModelSchema):
|
||||
id: UUID
|
||||
type: Literal["edu", "competitive"]
|
||||
participation_type: Literal["solo"]
|
||||
|
||||
class Meta:
|
||||
model = Competition
|
||||
|
||||
@@ -9,6 +9,7 @@ from api.v1.ping.views import router as ping_router
|
||||
from api.v1.review.auth import ReviewerAuth
|
||||
from api.v1.review.views import router as review_router
|
||||
from api.v1.user.views import router as user_router
|
||||
from api.v1.task.views import router as task_router
|
||||
|
||||
router = NinjaAPI(
|
||||
title="DataRush API",
|
||||
@@ -37,6 +38,11 @@ router.add_router(
|
||||
review_router,
|
||||
auth=ReviewerAuth(),
|
||||
)
|
||||
router.add_router(
|
||||
"",
|
||||
task_router,
|
||||
auth=BearerAuth(),
|
||||
)
|
||||
|
||||
|
||||
for exception, handler in handlers.exception_handlers:
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-01 22:16
|
||||
|
||||
import apps.competition.models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('competition', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='competition',
|
||||
name='image_url',
|
||||
field=models.ImageField(blank=True, null=True, upload_to=apps.competition.models.Competition.image_url_upload_to, verbose_name='изображение соревнования'),
|
||||
),
|
||||
]
|
||||
@@ -47,9 +47,6 @@ class Competition(BaseModel):
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
@property
|
||||
def
|
||||
|
||||
class Meta:
|
||||
verbose_name = "соревнование"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-01 22:16
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('task', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='competitiontask',
|
||||
options={'verbose_name': 'задание', 'verbose_name_plural': 'задания'},
|
||||
),
|
||||
]
|
||||
@@ -1,30 +0,0 @@
|
||||
import unittest
|
||||
|
||||
from apps.task.tasks import analyze_data_task
|
||||
|
||||
|
||||
class TestAnalyzeDataTask(unittest.TestCase):
|
||||
def test_task_execution_basic(self):
|
||||
code_str = 'print("Hello, World!")'
|
||||
result_path = "stdout"
|
||||
expected_bytes = b"Hello, World!\n"
|
||||
result = analyze_data_task(code_str, result_path, expected_bytes)
|
||||
self.assertTrue(result["success"])
|
||||
self.assertTrue(result["match"])
|
||||
|
||||
def test_task_execution_with_files(self):
|
||||
code_str = """
|
||||
with open("file.txt") as f:
|
||||
print(f.read())
|
||||
"""
|
||||
result_path = "stdout"
|
||||
expected_bytes = b"some_content\n"
|
||||
result = analyze_data_task(
|
||||
code_str,
|
||||
result_path,
|
||||
expected_bytes,
|
||||
input_files=[{"bind_at": "file.txt", "content": b"some_content"}],
|
||||
)
|
||||
print(result)
|
||||
self.assertTrue(result["success"])
|
||||
self.assertTrue(result["match"])
|
||||
@@ -0,0 +1,9 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from apps.team.models import Team
|
||||
|
||||
|
||||
@admin.register(Team)
|
||||
class TeamAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "owner")
|
||||
search_fields = ("name", "owner", "members",)
|
||||
@@ -0,0 +1,7 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class TeamConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'apps.team'
|
||||
verbose_name = "Команды"
|
||||
@@ -0,0 +1,30 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-01 22:16
|
||||
|
||||
import django.db.models.deletion
|
||||
import uuid
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('user', '0002_alter_user_email_alter_user_password_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Team',
|
||||
fields=[
|
||||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||
('name', models.CharField(max_length=50, verbose_name='название')),
|
||||
('members', models.ManyToManyField(related_name='team_members', to='user.user', verbose_name='участники')),
|
||||
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.user', verbose_name='владелец')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'команда',
|
||||
'verbose_name_plural': 'команды',
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,19 @@
|
||||
from django.db import models
|
||||
|
||||
from apps.core.models import BaseModel
|
||||
from apps.user.models import User
|
||||
|
||||
|
||||
class Team(BaseModel):
|
||||
name = models.CharField(max_length=50, verbose_name="название")
|
||||
owner = models.ForeignKey(User, on_delete=models.CASCADE,
|
||||
verbose_name="владелец")
|
||||
members = models.ManyToManyField(User, related_name="team_members",
|
||||
verbose_name="участники")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
verbose_name = "команда"
|
||||
verbose_name_plural = "команды"
|
||||
@@ -448,6 +448,7 @@ INSTALLED_APPS = [
|
||||
"apps.competition",
|
||||
"apps.review",
|
||||
"apps.task",
|
||||
"apps.team",
|
||||
]
|
||||
|
||||
# tinymce
|
||||
|
||||
Reference in New Issue
Block a user