Skip to content

Commit

Permalink
fix: checkduplicate -1 to 0 on error
Browse files Browse the repository at this point in the history
  • Loading branch information
lumpsoid committed Jul 5, 2024
1 parent 62c3929 commit 4a10ad6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/repository/bill/sqlite_bill_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ func (r *SqliteBillRepository) CheckDuplicateBill(bill *bl.Bill) (int, error) {
bill.GetCurrencyString(),
)
if err != nil {
return -1, err
return 0, err
}
defer rows.Close()

Expand All @@ -488,7 +488,7 @@ func (r *SqliteBillRepository) CheckDuplicateBill(bill *bl.Bill) (int, error) {
var id string
err = rows.Scan(&id)
if err != nil {
return -1, err
return 0, err
}
billArr = append(billArr, id)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/server/webapi/handlers/bill_from_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ var BillFromLinkResponse = server.Post("/bill-from-link", func(s *server.Server)
r.Message = fmt.Sprintf("%v\n", err)
return c.Render(http.StatusOK, "bill-from-link-response.html", r)
}
if billDupCount != -1 {
if billDupCount > 0 {
r.Success = false
r.Message = fmt.Sprintf("Find duplicates in the db = %d\n", billDupCount)
r.Message = fmt.Sprintf("Find duplicates = %d\n", billDupCount)
return c.Render(http.StatusOK, "bill-from-link-response.html", r)
}

Expand Down

0 comments on commit 4a10ad6

Please sign in to comment.