Code Monkey home page Code Monkey logo

mdoj's Introduction

MDCPP

Hello Here~~~

這是一個奇怪的地方,放一些計畫,你可以看看下方的目錄

mdoj's People

Contributors

eason0729 avatar kaiyohugo avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

eason0729

mdoj's Issues

Deprecate API desgin for verification mechanism

In early design, we would like admin to verification every problem/contest created by user.

However, in our later discussion, we decide to remove(decide to not implement them) verification mechanism.

For reference, codeforces don't require admin to verify user submitted content.

Provide a chat area for each problem

Add new feature: Provide a chat area for each problem.

To do list:

backend

  • update migration
  • add new database entity
  • compare manual database entity with codegen by migration
  • add new controller(if we want to cache)

proto

  • change database proto

Provide sorting guarantee for list_by_*

Problem

We haven't yet provide any kind of sort for list_by_* rpc, providing such guarantee is useful in many situation.

For example, you have 100 problem in a contest(so you want to use paginator), by guarantee secquence of all problem are sorted in ascending, we can partially render problem without actually retrieve 100 problem from the server.

TODO

  • add new paginator-session type (use related_filter() and PaginateCol)
  • update comment in backend.proto
  • update migration and entity declaration
  • implement in backend

Hide order logic in backend

In current API, we expose a order field for api consumer to set value, them frontend can ask server to order response of list request by that value.

Basic example could be...

  1. We have a contest with 0 problem(user want 4 of them)
  2. Add Problem A to contest: set problem A's order to 1.0
  3. Add problem D to contest: set problem D's order to 2.0
  4. Add problem B to contest by inserting in the middle: set problem-B's order to 1.5
  5. Add problem C to contest by inserting in the middle: Set problem-C's order to 1.75

In that way, client could list problem in order.

This proposal is intended to move such logic to backend.

the proposed API is similar to such:

message AddToContestRequest{
  required int32 contest_id = 1;
  required int32 problem_id = 2;
  optional string request_id = 3;
}

service Problem{
  /** Add to end of the contest */
  rpc AddToContest(AddToContestRequest) returns (Empty);
}

message InsertRequest{
  optional string request_id = 1;
  optional int32 pivot_id = 2;
  required int32 problem_id = 3;
}

service Contest{
  /** 
   * move the problem to just one after pivot
   * 
   * if pivot is null, insert at front
   */
  rpc insert(InsertRequest) returns (Empty);
}

Serve precompressed *.gz file

When using leptos-build, run with --pre-compress will compress all static wasm/js/css...

For example:

tree /site/
/site/
├── favicon.ico
├── favicon.ico.br
├── favicon.ico.gz
└── pkg
    ├── mdoj.css
    ├── mdoj.css.br
    ├── mdoj.css.gz
    ├── mdoj.js
    ├── mdoj.js.br
    ├── mdoj.js.gz
    ├── mdoj.wasm
    ├── mdoj.wasm.br
    └── mdoj.wasm.gz

By just serving compressed content, we can save about 70% of bandwidth.

However, leptos-build won't help you serving them, you need to write them in actual code.

Fix comment in `WithToken`

pub trait WithToken: Sized {
/// this will try to add token to request.
///
/// Will return error if token is not exist
fn with_optional_token(self, token: Option<String>) -> Request<Self>;
/// this will try to add token to request.
///
/// If token is not exist, it will just ignore error and return request without token
fn with_token(self, token: String) -> Request<Self>;
}

change backend api for better readability

  • change pagination to use optional instead of oneof. (ref)
  • split SortBy, example: ProblemSortBy, ContestSortBy.
  • decouple SortBy from proto
  • rename link to addToContest
  • replace bit flag with enum

use PartialModel to improve performance

Before working on PartialModel, we should rewrite Pager first.

  • decouple pagination logic from Select<E> recreation
  • Rewite paginator struct and serialize method to reduce overhead(also eliminate the need of signing session)
  • Writer an adopter for Pager

The actual work:

  • write PartialModel
  • write session update logic
  • replace existing Pager

Basic Frontend

TODO

  • Navbar
  • Footer
  • Login page
  • web-grpc api config
  • fix ssr error
  • Use cookie for token to complete fix ssr error
  • Error handling
  • #35
  • #36
  • Contests page
  • Rank page
  • Submission page
  • #39
  • #37
  • Problem Page
  • #38
  • #46
  • #47
  • #57
  • Create Contest Page

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.