Skip to content

Commit

Permalink
fix: no report.Floor when update an exists floor
Browse files Browse the repository at this point in the history
  • Loading branch information
JingYiJun committed Sep 27, 2023
1 parent 468df12 commit ae38613
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion models/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ func (report *Report) Create(c *fiber.Ctx, db ...*gorm.DB) error {
err = tx.Create(&report).Error
} else {
existingReport.Reason = existingReport.Reason + "\n" + report.Reason
err = tx.Save(&existingReport).Error
err = tx.Model(&existingReport).Update("reason", existingReport.Reason).Error // update reason and load floor in AfterUpdate hook
report.Floor = existingReport.Floor
}

if err != nil {
Expand Down

0 comments on commit ae38613

Please sign in to comment.