Skip to content

Commit

Permalink
adding pending and failed payments to filter count
Browse files Browse the repository at this point in the history
  • Loading branch information
elraphty committed Oct 31, 2024
1 parent cc89621 commit 731d5b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,17 +537,23 @@ func (db database) GetFilterStatusCount() FilterStattuCount {
var assignedCount int64
var completedCount int64
var paidCount int64
var pendingCount int64
var failedCount int64

db.db.Model(&Bounty{}).Where("show != false").Where("assignee = ''").Where("paid != true").Count(&openCount)
db.db.Model(&Bounty{}).Where("show != false").Where("assignee != ''").Where("paid != true").Count(&assignedCount)
db.db.Model(&Bounty{}).Where("show != false").Where("assignee != ''").Where("completed = true").Where("paid != true").Count(&completedCount)
db.db.Model(&Bounty{}).Where("show != false").Where("assignee != ''").Where("paid = true").Count(&paidCount)
db.db.Model(&Bounty{}).Where("show != false").Where("assignee != ''").Where("payment_pending = true").Count(&pendingCount)
db.db.Model(&Bounty{}).Where("show != false").Where("assignee != ''").Where("payment_failed = true").Count(&failedCount)

ms := FilterStattuCount{
Open: openCount,
Assigned: assignedCount,
Completed: completedCount,
Paid: paidCount,
Pending: pendingCount,
Failed: failedCount,
}

return ms
Expand Down
2 changes: 2 additions & 0 deletions db/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,8 @@ type FilterStattuCount struct {
Assigned int64 `json:"assigned"`
Completed int64 `json:"completed"`
Paid int64 `json:"paid"`
Pending int64 `json:"pending"`
Failed int64 `json:"failed"`
}

func (Person) TableName() string {
Expand Down

0 comments on commit 731d5b2

Please sign in to comment.