daily-code icon indicating copy to clipboard operation
daily-code copied to clipboard

Need DSA problems ASAP

Open hkirat opened this issue 10 months ago • 18 comments

There is already a code type that shows code on the right, problem statement on the left We need

Admin dashboard

Allow admins to put in

  1. Problem statement
  2. Title
  3. Test cases

User side

User can see the problem statement on the left Code editor on the right Submit the code

After the code is submitted, it hits a HTTP Endpoint which runs all test cases one after the other We can use judge0 for this, assume it is already deployed

Languages to support for now -

  1. CPP
  2. Javascript

hkirat avatar Apr 02 '24 15:04 hkirat

Callout we already have a code type

hkirat avatar Apr 02 '24 15:04 hkirat

On It

Rash-Hit avatar Apr 02 '24 15:04 Rash-Hit

@hkirat .. using piston is fine ??

https://github.com/code100x/daily-code/assets/73944177/8af73f61-8eb4-4cb7-b298-cf990e82b0a4

Rash-Hit avatar Apr 02 '24 18:04 Rash-Hit

piston?

hkirat avatar Apr 03 '24 23:04 hkirat

@hkirat , so i have used piston execute for running code - https://piston.readthedocs.io/en/latest/api-v2/#execute in the above video . please check it . dont know its a good way or not

Rash-Hit avatar Apr 04 '24 02:04 Rash-Hit

Have started working on this, integrating it with judge0. Might take ~2 days.

nimit9 avatar Apr 04 '24 07:04 nimit9

@nimit9 right now i am working on langauge support almost done ..

Rash-Hit avatar Apr 04 '24 07:04 Rash-Hit

Hey @Rash-Hit please go ahead with it, this is something where I think I'll get to learn something, so just building it out of fun and curiosity. Trying to build it very robustly and with a good looking UI. Won't be stealing your bounty lol

nimit9 avatar Apr 04 '24 07:04 nimit9

@hkirat , can you please confirm the schema ?? or suggestions ?? @nimit9

image

Rash-Hit avatar Apr 04 '24 19:04 Rash-Hit

@hkirat Progress so far ..

https://github.com/code100x/daily-code/assets/73944177/4b8ff91f-c667-42eb-92af-4c08ae73cb32

Rash-Hit avatar Apr 04 '24 19:04 Rash-Hit

@hkirat completed DSA Admin dashboard please have a look Step 1 - Admin Login Step 2 - Admin enters the problem name , description , topics , difficulty and number of input argument and Types for input and output Step 3 - Admin adds the driver code , user code , solution for the problem and the test cases (minimum 2) to publish the problem Step 4- Admin Publish the problem only if every details are completed

https://github.com/code100x/daily-code/assets/148727119/900a7a44-3ea0-40c8-9dd4-c0a8fb1035a5

akshatarora130 avatar Apr 07 '24 00:04 akshatarora130

@hkirat Progress so far ..

Progress.So.Far.mp4

If this is Monaco Editor. Add a path attribute to the editor which you can keep the language name. So that it will context switch and will give you the correct format even when you switch language.

Ref:


<Editor
          heading="Editor"
          height={"100%"}
          defaultLanguage={globalState.currentLanguage.languageCode}
          value={globalState.editorCode}
          onChange={setCode}
          theme={globalState.isDarkMode ? "vs-dark" : "vs-light"}
          options={options}
          path={globalState.currentLanguage.languageCode}
        />

SujithThirumalaisamy avatar Apr 10 '24 22:04 SujithThirumalaisamy

Might help someone, the db might can look like something like this

enum SubmissionResult {
  PENDING
  PASS
  FAIL
  RUNTIME_ERROR
  COMPILATION_ERROR
}

model User {
  id                Int           @id @default(autoincrement())
  submissions       Submission[]
  createdProblems   ProblemStatement[]
}

model ProblemStatement {
  id              Int           @id @default(autoincrement())
  title           String        @unique
  problemText     String
  testCases       TestCase[]
  submissions     Submission[]
  passedSubmissions Int @default(0)
  failedSubmissions Int @default(0)
  creator         User          @relation(fields: [creatorId], references: [id])
  creatorId       Int
}

model TestCase {
  id                Int           @id @default(autoincrement())
  input             String
  expectedOutput    String
  problemStatement  ProblemStatement @relation(fields: [problemStatementId], references: [id])
  problemStatementId Int
}

model Submission {
  id              Int           @id @default(autoincrement())
  code            String
  language        String
  result          SubmissionResult @default(PENDING)
  runtime         Int             // in milliseconds
  memoryUsage     Int             // in bytes
  errorMessage    String
  createdAt       DateTime      @default(now())
  problemStatement   ProblemStatement   @relation(fields: [problemStatementId], references: [id])
  problemStatementId Int
  user            User          @relation(fields: [userId], references: [id])
  userId          Int
}

This is for prisma but can be replicated :0

Hope it helps someone

siinghd avatar Apr 11 '24 17:04 siinghd

@hkirat Progress so far ..

Progress.So.Far.mp4

How is the current progress of this? Intrested in working on this! Feel free to add me with you.

SujithThirumalaisamy avatar Apr 12 '24 09:04 SujithThirumalaisamy

@hkirat completed DSA Admin dashboard please have a look Step 1 - Admin Login Step 2 - Admin enters the problem name , description , topics , difficulty and number of input argument and Types for input and output Step 3 - Admin adds the driver code , user code , solution for the problem and the test cases (minimum 2) to publish the problem Step 4- Admin Publish the problem only if every details are completed

adminDashboardDSA.1.1.mp4

@hkirat

https://github.com/code100x/daily-code/assets/148727119/b14da787-de5e-4f92-b9c6-738e01bcdcdf

User Dashboard More things that can be added

  • Submission Page
  • Solution page
  • Making the running time faster
  • UI can be enhanced

akshatarora130 avatar Apr 12 '24 15:04 akshatarora130

@hkirat completed DSA Admin dashboard please have a look Step 1 - Admin Login Step 2 - Admin enters the problem name , description , topics , difficulty and number of input argument and Types for input and output Step 3 - Admin adds the driver code , user code , solution for the problem and the test cases (minimum 2) to publish the problem Step 4- Admin Publish the problem only if every details are completed adminDashboardDSA.1.1.mp4

@hkirat

UserDashboard.mp4 User Dashboard More things that can be added

  • Submission Page
  • Solution page
  • Making the running time faster
  • UI can be enhanced

@hkirat If you like the prototype for both Admin and userDashboard I can create the pull request else if you want me to add some other features please tell

akshatarora130 avatar Apr 12 '24 15:04 akshatarora130

@hkirat Completed ~60-70% of this

Pending Things:

  • Admin Dashboard FOrm to Create the PS, Test Cases
  • adding Runtime Error info in the test run section (right bottom panel)
  • Auth flow to submit the code with rate limiting
  • Improving the code structure.
  • UI Improvements (someone else can work on this, otherwise I'll take it up)

Below is the video with things already done, Using judge0 self hosted on local. Please assign the issue to me, so that I can finish the pending work, and let me know if you'd need any changes in this.

Code Submit.webm

Code-Exec Test Run.webm

nimit9 avatar Apr 12 '24 18:04 nimit9

I have created a similar project can i try to integrate that to this project link of the project that i have created ->Video https://youtu.be/hTsJoKkY07U?si=NCNFPIsDKqcKypop Codesubmission using Judege0 and Build using Nextjs

Prontent11 avatar Apr 13 '24 14:04 Prontent11

@hkirat Completed ~60-70% of this

Pending Things:

  • Admin Dashboard FOrm to Create the PS, Test Cases
  • adding Runtime Error info in the test run section (right bottom panel)
  • Auth flow to submit the code with rate limiting
  • Improving the code structure.
  • UI Improvements (someone else can work on this, otherwise I'll take it up)

Below is the video with things already done, Using judge0 self hosted on local. Please assign the issue to me, so that I can finish the pending work, and let me know if you'd need any changes in this.

Code.Submit.webm Code-Exec.Test.Run.webm

Nimit can you please update with the latest completed and pending things? I am ready to work on any of this mentioned.

SujithThirumalaisamy avatar Apr 14 '24 17:04 SujithThirumalaisamy