ictsc / ictsc-score-server Goto Github PK
View Code? Open in Web Editor NEWICTトラブルシューティングコンテストのスコアサーバー
License: MIT License
ICTトラブルシューティングコンテストのスコアサーバー
License: MIT License
/api/answers
/api/attachments
/api/:commentables/:commentable_id/comments
/api/contests
/api/issues
/api/members
/api/notices
/api/notifications
/api/problems
/api/problem_groups
/api/scores
/api/scoreboard
/api/teams
problems?with=answers-score
を使わない(性能対策)大会全体に関するお知らせ等を保持するモデル, API の作成
Notice
持つ属性は以下の通り (DB)
id: integer
title: string
text: string
pinned: boolean
created_at: datetime
updated_at: datetime
GET 時のエンティティの埋め込みについて、現状ではパラメータ無しで一定のエンティティが埋め込まれているが、with
パラメータを付けることで制御できるようにする
また、 with
パラメータが無い場合は、ICTSC6 と同様に何も埋め込まないようにする
-
で繋ぐGET /api/answers?with=comments,score
GET /api/session?with=member,member-team
以下のような文章を事前にプレースホルダに入れておくことで、参加者により良い体裁の質問 / 解答の提出を促す
解答状況を色分けして表示する機能が正常に動いていない。
チームと解答に対する得点は正常に表示されているので、値の取得に問題がある。
現在、解答 (answers
) には複数のコメント (comments
) を付加することができ、それらをまとめて1つの解答として送信することができる。
しかし、有用性に掛けることやUI上分かりづらい, 実際に使われなかった等の事柄を勘案した上で、解答に対するコメントは1つのみとし、即座に採点待ち状態になるようにする。
D, [2017-02-21T15:27:19.138834 #18877] DEBUG -- : Notice Load (0.6ms) SELECT "notices".* FROM "notices" WHERE "notices"."id" = ? LIMIT ? [["id", 2], ["LIMIT", 1]]
D, [2017-02-21T15:27:19.141516 #18877] DEBUG -- : Member Exists (0.3ms) SELECT 1 AS one FROM "members" WHERE "members"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
D, [2017-02-21T15:27:19.142276 #18877] DEBUG -- : Member Load (0.1ms) SELECT "members".* FROM "members" WHERE "members"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
D, [2017-02-21T15:27:19.143241 #18877] DEBUG -- : Role Load (0.1ms) SELECT "roles".* FROM "roles" WHERE "roles"."id" = 2
2017-02-21 15:27:19 - NameError - undefined local variable or method `user' for #<Notice:0x007fe59c5401f8>:
/home/kamijin/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activemodel-5.0.1/lib/active_model/attribute_methods.rb:433:in `method_missing'
/mnt/c/Users/kamijin/Documents/git/ictsc-score-server/db/model.rb:629:in `allowed?'
/mnt/c/Users/kamijin/Documents/git/ictsc-score-server/controllers/notice.rb:21:in `block in <class:NoticeRoutes>'
/home/kamijin/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `call'
contest.yml に従った動作をするようにする
現状では管理ユーザは新規グループを追加できるが、登録済みのグループが編集できない。
グループの説明やボーナスの点数変更などができないのは問題では?
MarkingRequest モデルを追加, 1 Answer : 0 or 1 MarkingRequest
POST /api/answers/:id/marking_request
で採点依頼を出すようにする
問題詳細ページにおいて、UX向上のために質問を状態ごとにソートしたい
PUT Request for endpoints needs parameter *_id
doesn't work properly.
For example:
/api/answers
has fields: member_id
and team_id
Member
and Team
in Answer
class/api/answers
requires fields member
and team
but these parameters are filtered
member_id
and team_id
are passed through attribute_values_of_class
[1] pry(#<AnswerRoutes>)> params
=> {"problem_id"=>"10", "team_id"=>"1", "splat"=>[], "captures"=>["5005"], "id"=>"5005"}
[2] pry(#<AnswerRoutes>)> attribute_names_of_class(Answer)
=> [:problem_id, :team_id]
[3] pry(#<AnswerRoutes>)> attribute_values_of_class(Answer)
=> {:problem_id=>"10", :team_id=>"1"}
[4] pry(#<AnswerRoutes>)> Answer.required_fields
=> [:problem, :team]
[5] pry(#<AnswerRoutes>)> satisfied_required_fields?(Answer)
=> false
answer.comments == [] な answer を completed: true にすることは意味がないので、禁止するべき
answer.updated_at + contest.answer_reply_delay_sec
が解答の開示時刻
フロントエンドの実装上、API そのものを N+1 のように叩くことが避けられていなかったので対処する
対処法: /problems
や /issues
などのエンドポイントに関連するエンティティを埋め込む
できるといいですね……
新デザインに合わせて修正
1000文字なのでもう少し増やした方がよさそう
得点と解答ページ経由で問題ページへ移動した際に、解答欄が表示される。
実際に送信することはできないが、送信を試行することができるため非表示にする。
採点待ち時間が経過した後は、Participants による
GET /api/answers
GET /api/answers/:id
に score を含める必要がある。
contest.yml に従って表示時間を制御できるようにする
現状では /api/notification
をたたくことで幾つかの通知は得られるが、これではポーリングによるフロントエンド実装しかできない。
結果として、ユーザ数x(1/更新頻度)/sec のリクエストが飛ぶことになるため、望ましくない。
理想としては、SSEやWebSocket を使用して通知を行うようにするべき
現状では、 config/contest.yml
に設定を書いている。
そのため、コンテナで動かす場合やテストの際にファイルを上書きする必要がある。
これを環境変数で渡すようにすることで、容易にパラメータの変更が行えるようにする。
参加者は、 answer: completed な Answer に対し、新たに Comment を作成できてはならない
ログイン画面でUI側のパラメータが正常に設定されないために、ログイン後に不必要な項目が表示されている場合がある(一般ユーザでログインした場合に、解答一覧のリンクが表示される等)。
/api/notifications を ICTSC7 仕様に修正する
/api/scoreboard
にファーストブラッドを反映した点数を返す🤔
GET /api/scoreboard
自チームの1つ上の順位のチームが複数あるとき、自チーム順位とそれらのチームの順位は2以上開くため、それに対応する。
現時点ではメンバー登録において、チームIDは必須でない
この操作を、ログインしてない状態で行う際には、チームIDを必須にすべき
http://localhost:3000/api/teams/:team_id?with=answers-score
にアクセスすると全チームの回答状況を閲覧可能
D, [2017-02-22T15:49:15.387459 #21746] DEBUG -- : Comment Load (0.3ms) SELECT "comments".* FROM "comments" WHERE "comments"."commentable_type" = ? ORDER BY "comments"."updated_at" ASC [["commentable_type", "Problem"]]
2017-02-22 15:49:15 - NoMethodError - undefined method `team_id' for nil:NilClass:
/mnt/c/Users/kamijin/Documents/git/ictsc-score-server/controllers/notification.rb:66:in `block in <class:NotificationRoutes>'
problems?with=answers,score
で情報は取れるはず
http://www.atmarkit.co.jp/fsecurity/special/167ctf/zu01l.jpg
こういうのあったらいいですね 🙏
問題 / 質問等のコメント等に対して画像等のファイルを添付できるようにする
/comments/:id/attachments
/problems/:id/attachments```
ICTSC8 のルール にそって用語を変更する
contest.yml を参照して、/problems を制御する
競技時間終了後には、採点依頼のあるなしにかかわらず、一切のスコアを表示できなくする
現状では、それぞれの問題で満点が決まっているにもかかわらず、満点以上の点数をつけることができる。
そのため、採点者側のミスで満点以上の点を与えてしまう可能性がある。
なので、uiとapiの両方(またはどちらか)で満点以上の点数をつけられないよう、チェックを追加する必要がある。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.