mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 01:37:11 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -46,7 +46,7 @@ class CompetitionTask(BaseModel):
|
||||
)
|
||||
|
||||
# only when "review" type
|
||||
# todo make it more humanize
|
||||
# TODO make it more humanize
|
||||
criteries = models.JSONField(
|
||||
blank=True,
|
||||
null=True,
|
||||
@@ -60,10 +60,19 @@ class CompetitionTask(BaseModel):
|
||||
return self.title
|
||||
|
||||
class Meta:
|
||||
verbose_name = "задание"
|
||||
verbose_name_plural = "задания"
|
||||
|
||||
|
||||
class CompetitionTaskAttachment(BaseModel):
|
||||
def file_upload_at(instance, filename):
|
||||
return f"/attachment/{instance.id}/file"
|
||||
|
||||
task = models.ForeignKey(CompetitionTask, on_delete=models.CASCADE)
|
||||
file = models.FileField(upload_to=file_upload_at)
|
||||
bind_at = models.FilePathField()
|
||||
public = models.BooleanField(default=False)
|
||||
|
||||
|
||||
class CompetitionTaskSubmission(BaseModel):
|
||||
class StatusChoices(models.TextChoices):
|
||||
SENT = "sent"
|
||||
|
||||
@@ -52,4 +52,4 @@ const TaskContent: React.FC<TaskContentProps> = ({ task }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default TaskContent;
|
||||
export default TaskContent;
|
||||
|
||||
@@ -6,7 +6,7 @@ import CompetitionHeader from "./components/CompetitionHeader";
|
||||
import TaskContent from "./components/TaskContent";
|
||||
import TaskSolution from "./modules/TaskSolution";
|
||||
|
||||
const CompetitionSessionPage = () => {
|
||||
const CompetitionSession = () => {
|
||||
const { id, taskId } = useParams<{ id: string; taskId?: string }>();
|
||||
const [tasks] = useState<Task[]>(mockTasks);
|
||||
const [answer, setAnswer] = useState("");
|
||||
@@ -21,9 +21,6 @@ const CompetitionSessionPage = () => {
|
||||
console.log("Submitting answer:", answer);
|
||||
};
|
||||
|
||||
const handleHistoryClick = () => {
|
||||
console.log("View history");
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col min-h-screen">
|
||||
@@ -44,7 +41,6 @@ const CompetitionSessionPage = () => {
|
||||
answer={answer}
|
||||
setAnswer={setAnswer}
|
||||
onSubmit={handleSubmit}
|
||||
onHistoryClick={handleHistoryClick}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
@@ -60,4 +56,4 @@ const CompetitionSessionPage = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default CompetitionSessionPage;
|
||||
export default CompetitionSession;
|
||||
-3
@@ -5,13 +5,11 @@ import { Solution } from "@/shared/types";
|
||||
import { mockSolutions } from '@/shared/mocks/mocks';
|
||||
|
||||
interface ActionButtonsProps {
|
||||
onHistoryClick: () => void;
|
||||
onSubmit: () => void;
|
||||
solutionHistory?: Solution[];
|
||||
}
|
||||
|
||||
const ActionButtons: React.FC<ActionButtonsProps> = ({
|
||||
onHistoryClick,
|
||||
onSubmit,
|
||||
solutionHistory = mockSolutions
|
||||
}) => {
|
||||
@@ -19,7 +17,6 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({
|
||||
|
||||
const handleHistoryClick = () => {
|
||||
setIsHistoryOpen(true);
|
||||
onHistoryClick();
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import React, { useRef, useEffect, useState } from 'react';
|
||||
import * as monaco from 'monaco-editor';
|
||||
import { Copy, Check } from 'lucide-react'; // Import Lucide React icons
|
||||
import { Copy, Check } from 'lucide-react';
|
||||
|
||||
interface CodeSolutionProps {
|
||||
answer: string;
|
||||
|
||||
+1
-1
@@ -41,4 +41,4 @@ const SolutionStatus: React.FC<SolutionStatusProps> = ({ solution }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default SolutionStatus;
|
||||
export default SolutionStatus;
|
||||
|
||||
@@ -12,7 +12,7 @@ interface TaskSolutionProps {
|
||||
answer: string;
|
||||
setAnswer: (value: string) => void;
|
||||
onSubmit: () => void;
|
||||
onHistoryClick: () => void;
|
||||
|
||||
}
|
||||
|
||||
const TaskSolution: React.FC<TaskSolutionProps> = ({
|
||||
@@ -21,7 +21,6 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
|
||||
answer,
|
||||
setAnswer,
|
||||
onSubmit,
|
||||
onHistoryClick,
|
||||
}) => {
|
||||
const [selectedFile, setSelectedFile] = useState<File | null>(null);
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
@@ -46,7 +45,7 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
|
||||
<CodeSolution answer={answer} setAnswer={setAnswer} />
|
||||
)}
|
||||
|
||||
<ActionButtons onHistoryClick={onHistoryClick} onSubmit={onSubmit} />
|
||||
<ActionButtons onSubmit={onSubmit} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -23,8 +23,8 @@ export const authFetch = ofetch.create({
|
||||
|
||||
export const apiFetch = ofetch.create({
|
||||
baseURL: BASE_URL,
|
||||
headers: {
|
||||
Authorization: "Bearer " + getToken(),
|
||||
async onRequest({ options }) {
|
||||
options.headers.set("Authorization", "Bearer " + getToken());
|
||||
},
|
||||
async onResponseError({ response }) {
|
||||
if (response.status === 401) {
|
||||
|
||||
@@ -6,8 +6,6 @@ export const getToken = () => {
|
||||
|
||||
export const saveToken = (token: string) => {
|
||||
Cookie.set("token", token, {
|
||||
secure: true,
|
||||
sameSite: "Strict",
|
||||
expires: 30,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user