fix: check problem version exists before submit (#3)
This commit is contained in:
parent
297d031e5b
commit
6a72198541
@ -47,6 +47,13 @@ func (h *handler) Create(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// query latest version
|
||||
pv, status := h.problemService.QueryLatestVersion(req.Pid)
|
||||
if status != e.Success {
|
||||
e.Pong[any](c, status, nil)
|
||||
return
|
||||
}
|
||||
|
||||
// create submission
|
||||
createData := &submission.CreateData{
|
||||
ProblemID: req.Pid,
|
||||
@ -60,13 +67,6 @@ func (h *handler) Create(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// query latest version
|
||||
pv, status := h.problemService.QueryLatestVersion(req.Pid)
|
||||
if status != e.Success {
|
||||
e.Pong[any](c, status, nil)
|
||||
return
|
||||
}
|
||||
|
||||
// submit judge
|
||||
payload := &model.SubmitJudgePayload{
|
||||
ProblemVersionID: pv.ID,
|
||||
|
Loading…
Reference in New Issue
Block a user