Git Product home page Git Product logo

wisp-problems-microservice's People

Contributors

aehwany avatar cherryman avatar idodin avatar mohamedbeydoun avatar terror avatar valerianclerc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

terror

wisp-problems-microservice's Issues

500 Error on PUT Problems

Issuing a PUT request on /problems/:problemid results in a 500 error - upon further investigation, I've determined this is because the controller reassigns the value of the problemId from the MongoID which is expected on the request to the computed Platform-Problem hash.

CI should only push image on master

CI for building and pushing images shouldn't run on branches other than master OR, if it runs on a branch other than master, it should tag the image with branch_name-short_sha instead of just short_sha.

GET "/problems/:id/exists" route response modifications

Currently, the GET "/problems/:id/exists" route returns a 200 if a problem exists and a 404 if it doesn't. This causes some confusion in services that are using the route. Instead, the route should return status 200 for both cases with a boolean denoting if the problem exists in wisp or not.

IProblem Interface Enums

The IProblem interface used to set the fields "platformMetadata.difficulty" and "source" as type "Difficulty" and "PlatformName" respectively. This offered no validation for the values in the controllers and restricted values to 0, 1, and 2 when setting the fields manually. Currently, if the request body's value is different from the ones in the enums, the interface does nothing and it's up to mongo to throw the errors -> status 500. The types of these fields has since been changed in the interface to "string" in order to accomodate setting the values to strings instead of the ints 0, 1, and 2. From there, we now need to add custom validators to check if the request body values are indeed expected values.

For custim validators, see the validateProblemSetIds function in src/validators/problem

ProblemSetIds validation

Currently, users can submit problemSetIds that aren't mongo ObjectIds. This leads to a status 500 since mongo throws an error when parsing problemSetIds.

Problem model's platformProblemId should be standardized

platformProblemId (i.e. "1A" for Codeforces) should either always be uppercase or lowercase. Currently, either can be sent through the POST or PUT routes, and these result in different problemId hashes ("1A" vs "1a" hashes to different results).

Also need to check with wisp-users-microservice to see how we're doing it there, and we should standardize it there as well.

Initialize problemCount upon creating a new problemSet

Currently, problemCount is initialized when a problem is added to a problemSet. However, this can cause issues when a problemSet is created with existing problems. The issue can be solved by initializing the problemCount field as soon as the problemSet is created.

ProblemCount shouldn't be manually updateable

Currently the int problemCount in the problemSet model can be changed in a PUT request. This should not be the case, as then it could be manipulated to not properly represent the number of problems in a problemSet.

CI/CD Improvements

@idodin could we use the github short SHA as a tag instead of the full SHA?

Also I don’t think we need to push twice: right now we’re pushing once for the GitHub SHA tag and once for the “latest” tag. I believe that the images can have multiple tags, and can be pushed/referred to by either tag. And these tags persist when we push the image. @MohamedBeydoun can confirm this though

Contest creation logic

CRUD routes for Contest model.

Contest model ideas:

  • Inherit from problemSet?
  • Add more fields inside problemSet to indicate that it's a contest + store contest info?

In the model:

  • Start and end time
  • problemSet-like info
  • Scoreboard/participants

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.