Skip to content

Commit

Permalink
Merge pull request #285 from GiganticMinecraft/fix/chocies
Browse files Browse the repository at this point in the history
質問の選択肢が追加できないのを修正
  • Loading branch information
rito528 authored Sep 16, 2023
2 parents 6b40bc0 + 3b6d510 commit 000e89c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions server/infra/resource/src/database/form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,15 +456,12 @@ impl FormDatabase for ConnectionPool {
.await?
.last_insert_id;

let first_insert_id =
last_insert_id - form_question_update_schema.questions.len() as i32 + 1;

let question_ids: Vec<_> = (first_insert_id..last_insert_id).collect();

let choices_active_values = form_question_update_schema
.questions
.iter()
.zip(question_ids)
.rev()
.zip((0..=last_insert_id).rev())
.filter(|(q, _)| !q.choices.is_empty())
.flat_map(|(question, question_id)| {
question
.choices
Expand Down

0 comments on commit 000e89c

Please sign in to comment.