mirror of
https://github.com/massbug/judge4c.git
synced 2025-07-03 23:30:50 +00:00
Add random function to help create a series of test.
Add the answerType key to restrict the type of answer. Add the lengthOfArray key to rule the length of array or matrix. While if a single number just put null. Add new content of seed.ts like above all.
This commit is contained in:
parent
7f79b901b7
commit
3aa0a52b9e
13
prisma/migrations/20250616020439_add_random/migration.sql
Normal file
13
prisma/migrations/20250616020439_add_random/migration.sql
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- Added the required column `type` to the `Problem` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- CreateEnum
|
||||
CREATE TYPE "Type" AS ENUM ('NS', 'INT', 'FLOAT', 'CHAR', 'INTARRAY', 'FLOATARRAY', 'STRING', 'MATRIX');
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Problem" ADD COLUMN "isRandom" BOOLEAN NOT NULL DEFAULT false,
|
||||
ADD COLUMN "lengthOfArray" INTEGER[],
|
||||
ADD COLUMN "type" "Type" NOT NULL;
|
16
prisma/migrations/20250616021548_rename_type/migration.sql
Normal file
16
prisma/migrations/20250616021548_rename_type/migration.sql
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `type` on the `Problem` table. All the data in the column will be lost.
|
||||
- Added the required column `answerType` to the `Problem` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- CreateEnum
|
||||
CREATE TYPE "AnswerType" AS ENUM ('NS', 'INT', 'FLOAT', 'CHAR', 'INTARRAY', 'FLOATARRAY', 'STRING', 'MATRIX');
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Problem" DROP COLUMN "type",
|
||||
ADD COLUMN "answerType" "AnswerType" NOT NULL;
|
||||
|
||||
-- DropEnum
|
||||
DROP TYPE "Type";
|
@ -34,6 +34,17 @@ enum Protocol {
|
||||
wss
|
||||
}
|
||||
|
||||
enum AnswerType {
|
||||
NS // Not Suitable
|
||||
INT // Single Integer
|
||||
FLOAT // Single Float
|
||||
CHAR // Single Character
|
||||
INTARRAY // Integer Array
|
||||
FLOATARRAY // Float Array
|
||||
STRING // Single String
|
||||
MATRIX // Arrays
|
||||
}
|
||||
|
||||
enum Status {
|
||||
PD // PENDING
|
||||
QD // QUEUED
|
||||
@ -76,22 +87,22 @@ model User {
|
||||
}
|
||||
|
||||
model Problem {
|
||||
id String @id @default(cuid())
|
||||
displayId Int @unique
|
||||
difficulty Difficulty @default(EASY)
|
||||
isPublished Boolean @default(false)
|
||||
trim Boolean @default(false)
|
||||
timeLimit Int @default(1000)
|
||||
memoryLimit Int @default(134217728)
|
||||
|
||||
|
||||
id String @id @default(cuid())
|
||||
displayId Int @unique
|
||||
difficulty Difficulty @default(EASY)
|
||||
isPublished Boolean @default(false)
|
||||
trim Boolean @default(false)
|
||||
timeLimit Int @default(1000)
|
||||
memoryLimit Int @default(134217728)
|
||||
isRandom Boolean @default(false)
|
||||
answerType AnswerType
|
||||
lengthOfArray Int[]
|
||||
|
||||
localizations ProblemLocalization[]
|
||||
templates Template[]
|
||||
testcases Testcase[]
|
||||
submissions Submission[]
|
||||
|
||||
|
||||
userId String?
|
||||
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
||||
|
@ -42,6 +42,8 @@ const problemData: Prisma.ProblemCreateInput[] = [
|
||||
difficulty: "EASY",
|
||||
isPublished: true,
|
||||
trim: true,
|
||||
answerType: "INTARRAY",
|
||||
lengthOfArray: [2, 3, 4, 5, 6],
|
||||
localizations: {
|
||||
create: [
|
||||
{
|
||||
@ -736,6 +738,8 @@ int main() {
|
||||
difficulty: "MEDIUM",
|
||||
isPublished: true,
|
||||
trim: true,
|
||||
answerType: "INTARRAY",
|
||||
lengthOfArray: [1, 2, 3],
|
||||
localizations: {
|
||||
create: [
|
||||
{
|
||||
@ -1264,6 +1268,8 @@ int main() {
|
||||
difficulty: "HARD",
|
||||
isPublished: true,
|
||||
trim: true,
|
||||
answerType: "INTARRAY",
|
||||
lengthOfArray: [1, 2, 3, 4, 5],
|
||||
localizations: {
|
||||
create: [
|
||||
{
|
||||
|
3
src/app/actions/random.ts
Normal file
3
src/app/actions/random.ts
Normal file
@ -0,0 +1,3 @@
|
||||
"use server"
|
||||
|
||||
function judgeRandom(){}
|
Loading…
Reference in New Issue
Block a user