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:
@@ -132,28 +132,29 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
def create_submissions(self, tasks, users):
|
def create_submissions(self, tasks, users):
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
# Each task will get between 1 and 3 submissions
|
if task.type == CompetitionTask.CompetitionTaskType.REVIEW.value:
|
||||||
num_submissions = random.randint(1, 3)
|
# Each task will get between 1 and 3 submissions
|
||||||
for _ in range(num_submissions):
|
num_submissions = random.randint(1, 3)
|
||||||
user = random.choice(users)
|
for _ in range(num_submissions):
|
||||||
# Create a dummy content file
|
user = random.choice(users)
|
||||||
dummy_content = ContentFile(
|
# Create a dummy content file
|
||||||
b"Submission content",
|
dummy_content = ContentFile(
|
||||||
name=f"submission_{uuid.uuid4().hex}.txt",
|
b"Submission content",
|
||||||
)
|
name=f"submission_{uuid.uuid4().hex}.txt",
|
||||||
submission = CompetitionTaskSubmission.objects.create(
|
)
|
||||||
user=user,
|
submission = CompetitionTaskSubmission.objects.create(
|
||||||
task=task,
|
user=user,
|
||||||
earned_points=random.randint(
|
task=task,
|
||||||
0, task.points if task.points else 10
|
earned_points=random.randint(
|
||||||
),
|
0, task.points if task.points else 10
|
||||||
content=dummy_content,
|
),
|
||||||
)
|
content=dummy_content,
|
||||||
submission.save()
|
)
|
||||||
submission.send_on_review()
|
submission.save()
|
||||||
self.stdout.write(
|
submission.send_on_review()
|
||||||
f"Created submission for task '{task.title}' by user '{user.username}'"
|
self.stdout.write(
|
||||||
)
|
f"Created submission for task '{task.title}' by user '{user.username}'"
|
||||||
|
)
|
||||||
|
|
||||||
def create_states(self, competitions, users):
|
def create_states(self, competitions, users):
|
||||||
# For each competition, create a State for some of its participants
|
# For each competition, create a State for some of its participants
|
||||||
|
|||||||
+14
-10
@@ -1,9 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Sheet, SheetClose, SheetContent, SheetHeader, SheetTitle } from "@/components/ui/sheet";
|
import { Sheet, SheetClose, SheetContent, SheetHeader, SheetTitle } from "@/components/ui/sheet";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { X } from "lucide-react";
|
import { X, Check } from "lucide-react";
|
||||||
import SolutionStatus from '../SolutionStatus';
|
import SolutionStatus from '../SolutionStatus';
|
||||||
import { Solution, TaskType } from '@/shared/types/task';
|
import { Solution } from '@/shared/types/task';
|
||||||
|
|
||||||
interface SolutionHistorySheetProps {
|
interface SolutionHistorySheetProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@@ -11,6 +11,7 @@ interface SolutionHistorySheetProps {
|
|||||||
solutions: Solution[];
|
solutions: Solution[];
|
||||||
maxPoints: number;
|
maxPoints: number;
|
||||||
onSolutionSelect: (solution: Solution) => void;
|
onSolutionSelect: (solution: Solution) => void;
|
||||||
|
currentSolutionId?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SolutionHistorySheet: React.FC<SolutionHistorySheetProps> = ({
|
const SolutionHistorySheet: React.FC<SolutionHistorySheetProps> = ({
|
||||||
@@ -18,7 +19,8 @@ const SolutionHistorySheet: React.FC<SolutionHistorySheetProps> = ({
|
|||||||
onOpenChange,
|
onOpenChange,
|
||||||
solutions,
|
solutions,
|
||||||
maxPoints,
|
maxPoints,
|
||||||
onSolutionSelect
|
onSolutionSelect,
|
||||||
|
currentSolutionId
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<Sheet open={isOpen} onOpenChange={onOpenChange}>
|
<Sheet open={isOpen} onOpenChange={onOpenChange}>
|
||||||
@@ -36,15 +38,17 @@ const SolutionHistorySheet: React.FC<SolutionHistorySheetProps> = ({
|
|||||||
|
|
||||||
<div className="flex flex-col mt-3 space-y-2.5 overflow-y-auto max-h-[calc(100vh-80px)] px-4 pb-4">
|
<div className="flex flex-col mt-3 space-y-2.5 overflow-y-auto max-h-[calc(100vh-80px)] px-4 pb-4">
|
||||||
{solutions.length > 0 ? (
|
{solutions.length > 0 ? (
|
||||||
solutions.map((solution, index) => (
|
solutions.map((solution) => (
|
||||||
<div
|
<div
|
||||||
key={solution.id || index}
|
key={solution.id}
|
||||||
className="w-full cursor-pointer transition-transform hover:scale-[1.01]"
|
className={`w-full cursor-pointer relative ${solution.id === currentSolutionId ? 'ring-2 ring-blue-500 rounded-lg' : ''}`}
|
||||||
onClick={() => {
|
onClick={() => onSolutionSelect(solution)}
|
||||||
onSolutionSelect(solution);
|
|
||||||
onOpenChange(false);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
|
{solution.id === currentSolutionId && (
|
||||||
|
<div className="absolute top-2 right-2 z-10 bg-blue-500 text-white rounded-full p-1">
|
||||||
|
<Check size={14} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<SolutionStatus solution={solution} maxPoints={maxPoints} />
|
<SolutionStatus solution={solution} maxPoints={maxPoints} />
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
|
|||||||
fileInputRef={fileInputRef}
|
fileInputRef={fileInputRef}
|
||||||
existingFileUrl={selectedSolutionUrl}
|
existingFileUrl={selectedSolutionUrl}
|
||||||
onClearExistingFile={handleClearExistingFile}
|
onClearExistingFile={handleClearExistingFile}
|
||||||
isLoading={isInitialLoading}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user