Giter Site home page Giter Site logo

algorithmic-arena's People

Contributors

ankur1493 avatar dillu786 avatar hkirat avatar iharsh02 avatar siinghd avatar sujiththirumalaisamy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

algorithmic-arena's Issues

[SUGGESTION] How about writing E2E Tests (Backend Specific)?

I could see three services in this repository:

  1. A PostgreSQL DB
  2. Redis (Caching and Queue)
  3. Express as a store of APIs

We should move towards writing tests for it! Unit Tests are fast but only test the business logic (they can't test whether the SQL query written is actually correct, a code passing all the unit tests might fail the code in production!) and Integration tests are slow (can become a headache for developers).
Therefore we can move to E2E Tests. These tests are faster than Integration tests and can be extended to test the action of these services!

So the route is simple:

  1. We need to setup testing instances of all the services, as tests should not contact the real instances. docker compose can be a good idea for this.

  2. We need to replace the the actual services with the testing instances when tests are running, that means Dependency Injection.

But there are some problems:

a) Dependency Injection Design Pattern: As far I know, there is no good library available for this in Nodejs. tsyringe is there, but it also uses a global instance of container, hence second point can't be achieved!

b) Docker might make the CI slow!

Solutions:

a) Traditional way of Dependency Injection (in JAVA) is by using Constructors and decorators on controllers but JS is a functional programming, so either we have to migrate to a new OOPs based framework like Nestjs or we might use a hack by just changing the protocol to GraphQL and using the context variable for Dependency Injection.

b) Caching in DockerFile and multi stage builds can fix this.

See this repo: https://github.com/Manik2708/Hi_Server which is implemented in Nestjs with E2E Tests and docker compose in CI.

Enhance dev env

Can we make the cloudflare captcha only work at production?

  • Make the cloudflare captcha only work at production

Suggestion : Add Custom Checkers

Currently, the answers are checked by matching each token of the output with the correct and

But for questions that have more than one correct answer, this might be wrong

For eg if the question is to print an odd number between a and b there can be multiple odd numbers that can be printed

I suggest allowing the problem setters to add custom checkers which will take the output of the users and then return the verdicts

For the example of odd numbers the script will check if the output is odd and is between a and b

Bug: Test Case Count Incorrectly Displayed as 0 in Problem Submission Table

Bug Description:

In the problem submission table, the number of test cases passed for each submission is always displayed as 0, regardless of the actual number of test cases that were passed. This issue persists across all problem submissions and misleads users regarding the success of their code.

Steps to Reproduce:

  1. Navigate to the problem submission page.
  2. Submit a solution to any coding problem.
  3. Observe the "Test Cases Passed" column in the submission table

Expected Behavior:

The "Test Cases Passed" column should reflect the actual number of test cases passed for each submission.

Actual Behavior:

The "Test Cases Passed" column displays 0 test cases passed for every submission.

Screenshots:

localhost-3000-problem-cly1pj4n40001ivozl8t7skfm

localhost-3000-problem-cly1pj4n40001ivozl8t7ssdkfm

Mount the test cases directly on judge0

Right now, our test cases have to go to judge0 via an HTTP call
If the test cases are very big, then you send a very big payload in an http call

If the test cases were direclty mounted on the judge0 server, then they can be directly picked up from there

Rate limt every user

A single user should be able to send at max 2 requests / 10 seconds

This should be done in a distributed way, use redis to store the rate at which the user is sending requests

Add husky in the project

currently in our project we don't have husky if we add husky it is very useful to check(commit message) or lint the project before the actually commit has made.

Race condition of test_cases status updates and latency in submission status updates

Screenshot 2024-06-12 021826

@hkirat
Is it correct way of solving this problem since Redis in single threaded so it gives us feature of mutex lock which will help to resolve this .
Since we want three things

  1. Maximum time
  2. Maximum memory
  3. Submission Status (AC or Reject)

These all three things will be handled by submission-callback endpoint
And Nextjs API used for polling will eventually show data on basis of this Redis

Screenshot 2024-06-12 021656

Migrate to pnpm

Currently the dependencies are not uptodate. Turbo version complaining on the key tasks. Which is migrated from pipeline key in the turbo@1^ to turbo@2^.

Migrate to pnpm. Update the scripta and fix all the dependencies and push the latest lock file.

Feature: UI for problem setters to add problem

Currently, to add problems, problem setters needs to clone the repo (which will probably be private at a later stage in production, so granting permission might be an overhead in that case) and then create a PR.

How about creating an interactive UI to add problems?

Rough sketch of what I am planning

Screenshot 2024-06-11 at 1 11 38 PM

Also, I have some ideas regarding the automation of other steps regarding this, so that the effort required by admin is minimum.

Please let me know whether you guys want this feature.

having this issue while running pnpm dlx turbo db:migrate && yarn install

Datasource "db": PostgreSQL database "algo-arena", schema "public" at "localhost:5432"

│ Error: P1001: Can't reach database server at localhost:5432

│ Please make sure your database server is running at localhost:5432.
│  ELIFECYCLE  Command failed with exit code 1.
│ command finished with error: command (/Users/veerpratap/Desktop/Cohort-3/algorithmic-arena/packages/db) /opt/homebr
│ ew/bin/pnpm run db:migrate exited (1)
└────>
ERROR run failed: command exited (1)

not able to start locally

server is crashing, please help how can i start prooject locally, i followed the insterection from read_me.md but nothing is working
and databse_url should be this DATABASE_URL="postgresql://postgres:supersecurepassword@localhost:5432/algo-arena"

Recording.2024-07-03.172753.mp4

Support 2d arrays

2 dimensional arrays can be added to Structure.md
Should be parsed for every language

Make sure user cant see/submit problems pre-contest

WE need to protect a few routes to ensure user isnt able to hit submit endpoints/see problems before a contest starts.
After the contest we need to make sure user cant send an activeContest variable, and if they do, their request is rejected

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.