Skip to content

Commit

Permalink
updated completion_date update
Browse files Browse the repository at this point in the history
  • Loading branch information
elraphty committed Apr 8, 2024
1 parent 064ca81 commit 8ef3264
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -1234,13 +1234,15 @@ func (db database) UpdateBountyPayment(b Bounty) (Bounty, error) {
db.db.Model(&b).Where("created", b.Created).Updates(map[string]interface{}{
"paid": b.Paid,
})
db.db.Model(&b).Where("created", b.Created).Updates(b)
return b, nil
}

func (db database) UpdateBountyCompleted(b Bounty) (Bounty, error) {
db.db.Model(&b).Where("created", b.Created).Updates(map[string]interface{}{
"completed": b.Completed,
})
db.db.Model(&b).Where("created", b.Created).Updates(b)
return b, nil
}

Expand Down
2 changes: 1 addition & 1 deletion handlers/bounty.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ func UpdateCompletedStatus(w http.ResponseWriter, r *http.Request) {
now := time.Now()
// set bounty as completed
if !bounty.Paid && !bounty.Completed {
bounty.Completed = true
bounty.CompletionDate = &now
bounty.Completed = true
}
db.DB.UpdateBountyCompleted(bounty)
}
Expand Down

0 comments on commit 8ef3264

Please sign in to comment.