mirror of
https://github.com/massbug/judge4c.git
synced 2025-07-04 15:50:51 +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
|
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 {
|
enum Status {
|
||||||
PD // PENDING
|
PD // PENDING
|
||||||
QD // QUEUED
|
QD // QUEUED
|
||||||
@ -83,15 +94,15 @@ model Problem {
|
|||||||
trim Boolean @default(false)
|
trim Boolean @default(false)
|
||||||
timeLimit Int @default(1000)
|
timeLimit Int @default(1000)
|
||||||
memoryLimit Int @default(134217728)
|
memoryLimit Int @default(134217728)
|
||||||
|
isRandom Boolean @default(false)
|
||||||
|
answerType AnswerType
|
||||||
|
lengthOfArray Int[]
|
||||||
|
|
||||||
localizations ProblemLocalization[]
|
localizations ProblemLocalization[]
|
||||||
templates Template[]
|
templates Template[]
|
||||||
testcases Testcase[]
|
testcases Testcase[]
|
||||||
submissions Submission[]
|
submissions Submission[]
|
||||||
|
|
||||||
|
|
||||||
userId String?
|
userId String?
|
||||||
|
|
||||||
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
||||||
|
@ -42,6 +42,8 @@ const problemData: Prisma.ProblemCreateInput[] = [
|
|||||||
difficulty: "EASY",
|
difficulty: "EASY",
|
||||||
isPublished: true,
|
isPublished: true,
|
||||||
trim: true,
|
trim: true,
|
||||||
|
answerType: "INTARRAY",
|
||||||
|
lengthOfArray: [2, 3, 4, 5, 6],
|
||||||
localizations: {
|
localizations: {
|
||||||
create: [
|
create: [
|
||||||
{
|
{
|
||||||
@ -736,6 +738,8 @@ int main() {
|
|||||||
difficulty: "MEDIUM",
|
difficulty: "MEDIUM",
|
||||||
isPublished: true,
|
isPublished: true,
|
||||||
trim: true,
|
trim: true,
|
||||||
|
answerType: "INTARRAY",
|
||||||
|
lengthOfArray: [1, 2, 3],
|
||||||
localizations: {
|
localizations: {
|
||||||
create: [
|
create: [
|
||||||
{
|
{
|
||||||
@ -1264,6 +1268,8 @@ int main() {
|
|||||||
difficulty: "HARD",
|
difficulty: "HARD",
|
||||||
isPublished: true,
|
isPublished: true,
|
||||||
trim: true,
|
trim: true,
|
||||||
|
answerType: "INTARRAY",
|
||||||
|
lengthOfArray: [1, 2, 3, 4, 5],
|
||||||
localizations: {
|
localizations: {
|
||||||
create: [
|
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