Merge branch 'master' of gitlab.prodcontest.ru:team-15/project

This commit is contained in:
ITQ
2025-03-03 00:42:32 +03:00
3 changed files with 37 additions and 33 deletions
@@ -132,6 +132,7 @@ class Command(BaseCommand):
def create_submissions(self, tasks, users): def create_submissions(self, tasks, users):
for task in tasks: for task in tasks:
if task.type == CompetitionTask.CompetitionTaskType.REVIEW.value:
# Each task will get between 1 and 3 submissions # Each task will get between 1 and 3 submissions
num_submissions = random.randint(1, 3) num_submissions = random.randint(1, 3)
for _ in range(num_submissions): for _ in range(num_submissions):
@@ -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}
/> />
)} )}