diff --git a/services/backend/apps/core/management/commands/generate_data.py b/services/backend/apps/core/management/commands/generate_data.py index 4d2a916..d6e6157 100644 --- a/services/backend/apps/core/management/commands/generate_data.py +++ b/services/backend/apps/core/management/commands/generate_data.py @@ -132,28 +132,29 @@ class Command(BaseCommand): def create_submissions(self, tasks, users): for task in tasks: - # Each task will get between 1 and 3 submissions - num_submissions = random.randint(1, 3) - for _ in range(num_submissions): - user = random.choice(users) - # Create a dummy content file - dummy_content = ContentFile( - b"Submission content", - name=f"submission_{uuid.uuid4().hex}.txt", - ) - submission = CompetitionTaskSubmission.objects.create( - user=user, - task=task, - earned_points=random.randint( - 0, task.points if task.points else 10 - ), - content=dummy_content, - ) - submission.save() - submission.send_on_review() - self.stdout.write( - f"Created submission for task '{task.title}' by user '{user.username}'" - ) + if task.type == CompetitionTask.CompetitionTaskType.REVIEW.value: + # Each task will get between 1 and 3 submissions + num_submissions = random.randint(1, 3) + for _ in range(num_submissions): + user = random.choice(users) + # Create a dummy content file + dummy_content = ContentFile( + b"Submission content", + name=f"submission_{uuid.uuid4().hex}.txt", + ) + submission = CompetitionTaskSubmission.objects.create( + user=user, + task=task, + earned_points=random.randint( + 0, task.points if task.points else 10 + ), + content=dummy_content, + ) + submission.save() + submission.send_on_review() + self.stdout.write( + f"Created submission for task '{task.title}' by user '{user.username}'" + ) def create_states(self, competitions, users): # For each competition, create a State for some of its participants diff --git a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/SolutionHistorySheet/index.tsx b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/SolutionHistorySheet/index.tsx index 870d511..3f181bd 100644 --- a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/SolutionHistorySheet/index.tsx +++ b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/SolutionHistorySheet/index.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { Sheet, SheetClose, SheetContent, SheetHeader, SheetTitle } from "@/components/ui/sheet"; import { Button } from "@/components/ui/button"; -import { X } from "lucide-react"; +import { X, Check } from "lucide-react"; import SolutionStatus from '../SolutionStatus'; -import { Solution, TaskType } from '@/shared/types/task'; +import { Solution } from '@/shared/types/task'; interface SolutionHistorySheetProps { isOpen: boolean; @@ -11,6 +11,7 @@ interface SolutionHistorySheetProps { solutions: Solution[]; maxPoints: number; onSolutionSelect: (solution: Solution) => void; + currentSolutionId?: string | null; } const SolutionHistorySheet: React.FC = ({ @@ -18,7 +19,8 @@ const SolutionHistorySheet: React.FC = ({ onOpenChange, solutions, maxPoints, - onSolutionSelect + onSolutionSelect, + currentSolutionId }) => { return ( @@ -36,15 +38,17 @@ const SolutionHistorySheet: React.FC = ({
{solutions.length > 0 ? ( - solutions.map((solution, index) => ( + solutions.map((solution) => (
{ - onSolutionSelect(solution); - onOpenChange(false); - }} + key={solution.id} + className={`w-full cursor-pointer relative ${solution.id === currentSolutionId ? 'ring-2 ring-blue-500 rounded-lg' : ''}`} + onClick={() => onSolutionSelect(solution)} > + {solution.id === currentSolutionId && ( +
+ +
+ )}
)) diff --git a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/index.tsx b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/index.tsx index e2262f9..fb8324b 100644 --- a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/index.tsx +++ b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/index.tsx @@ -120,7 +120,6 @@ const TaskSolution: React.FC = ({ fileInputRef={fileInputRef} existingFileUrl={selectedSolutionUrl} onClearExistingFile={handleClearExistingFile} - isLoading={isInitialLoading} /> )}