Skip to content

Commit

Permalink
Merge pull request #1252 from traPtitech/fix/EditResponse
Browse files Browse the repository at this point in the history
EditResponseで最後の質問の範囲が適用されていた問題を修正
  • Loading branch information
ErrorSyntax1 authored Jul 1, 2024
2 parents 19cb242 + a48e20a commit b1832bb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions router/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ func (r *Response) EditResponse(c echo.Context) error {
c.Logger().Errorf("failed to get scale labels: %+v", err)
return echo.NewHTTPError(http.StatusInternalServerError, err)
}
scaleLabelMap := make(map[int]*model.ScaleLabels, len(scaleLabels))
scaleLabelMap := make(map[int]model.ScaleLabels, len(scaleLabels))
for _, label := range scaleLabels {
scaleLabelMap[label.QuestionID] = &label
scaleLabelMap[label.QuestionID] = label
}

// LinearScaleのパターンマッチ
Expand All @@ -334,9 +334,9 @@ func (r *Response) EditResponse(c echo.Context) error {
case "LinearScale":
label, ok := scaleLabelMap[body.QuestionID]
if !ok {
label = &model.ScaleLabels{}
label = model.ScaleLabels{}
}
if err := r.CheckScaleLabel(*label, body.Body.ValueOrZero()); err != nil {
if err := r.CheckScaleLabel(label, body.Body.ValueOrZero()); err != nil {
c.Logger().Infof("invalid scale label: %+v", err)
return echo.NewHTTPError(http.StatusBadRequest, err)
}
Expand Down

0 comments on commit b1832bb

Please sign in to comment.