Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

错因系统 #98

Open
10 of 11 tasks
suntt2019 opened this issue Aug 28, 2021 · 1 comment · May be fixed by #99
Open
10 of 11 tasks

错因系统 #98

suntt2019 opened this issue Aug 28, 2021 · 1 comment · May be fixed by #99
Assignees

Comments

@suntt2019
Copy link
Member

suntt2019 commented Aug 28, 2021

Cause

Permission

Name Description
mark_causes CRUD permission on a problem's causes.

Models

  • Cause
    • ID (Primary Key)
    • ProblemID (Foreign Key - Problem)
    • TestCaseID (Foreign Key - TestCase)
    • Hash (string, index)
    • Marked (bool, default=false)
    • Description (string, text, markdown)
    • Point (uint) // 这个结果可以得的分(还是需要扣的分?)
    • Count (uint)
  • Run
    • Hash (edit, +index)

Resources

  • Cause - 给看自己错因的同学 // 这里不确定,有必要这样区分设计么,以及包含的feild是否合理
    • ID, ProblemID, TestCaseID, Hash, Marked, Description(少Point和Count)
  • CauseForAdmin - 给管理员
    • 所有信息,同Models,+OuputURL

Event

  • Run(当Run完成时触发)添加Listener UpdateOrInitCause
    • 主要实现部分在base/utils包中:检测是否有相同ProblemIDTestCaseIDHash的Cause
      • 若有,Count++,实现上使用锁(因为需要读取Count再写入,FirstOrInit似乎无法完成)
      • 若无,新建一个(Count=1,Marked=false,Point=0)

API

  • 修改GetSubmission

  • GetCause GET /api/problem/:problem_id/cause/:id

    • 功能:查看某个错因,以及cause的output的presigned_url
    • 权限:该题目的mark_causes权限
    • 请求:空
    • 响应:返回该CauseCauseForAdmin
  • GetCauses GET /api/problem/:problem_id/causes

    • 功能:查看所有错因
    • 权限:该题目的mark_causes权限
    • 请求:空
    • 响应:返回CauseForAdmin的切片
  • GetAllCauses GET /api/causes

    • 功能:查看全局所有错因
    • 权限:全局的mark_causes权限
    • 请求:空
    • 响应:返回CauseForAdmin的切片
  • UpdateCause PUT /api/problem/:problem_id/cause/:id

    • 功能:新标记错因或更新错因标记
      • Marked为false
        • Marked改为true
        • 将输出文件复制一份到bucketcause:problem_id/:cause_id.out
    • 权限:该题目的mark_causes权限
    • 请求:包含DescriptionPoint
    • 响应:返回该CauseCauseForAdmin
  • DeleteCause DELETE /api/problem/:problem_id/cause/:id

    • 功能:删除错因
    • 权限:该题目的mark_causes权限
    • 请求:空
    • 响应:MessageSUCCESSData为空
@suntt2019 suntt2019 self-assigned this Aug 28, 2021
@suntt2019 suntt2019 linked a pull request Aug 29, 2021 that will close this issue
@leoleoasd
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants