Skip to content

Commit

Permalink
fix(backend): fix backend submit iterator flatten fail on Option<Resu…
Browse files Browse the repository at this point in the history
…lt<_, _>>
  • Loading branch information
Eason0729 committed Sep 11, 2024
1 parent 3df904d commit f4ee034
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend/migration/src/m20231207_000001_create_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ enum Submit {
Status,
Accept,
Score,
Public
Public,
}
#[derive(Iden)]
enum Testcase {
Expand Down
5 changes: 2 additions & 3 deletions backend/src/endpoint/submit.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use super::*;
use futures::{FutureExt, TryFutureExt};

use crate::controller::judger::SubmitBuilder;
use crate::util::code::Code;
Expand All @@ -16,9 +15,9 @@ impl From<Model> for SubmitInfo {
fn from(value: Model) -> Self {
let db_code: Code = value
.status
.map(TryInto::try_into)
.map(|x| x.try_into().ok())
.flatten()
.unwrap_or_else(Code::Unknown);
.unwrap_or(Code::Unknown);
SubmitInfo {
id: value.id,
upload_time: into_prost(value.upload_at),
Expand Down

0 comments on commit f4ee034

Please sign in to comment.