Skip to content

Commit

Permalink
added completed count to filter status count
Browse files Browse the repository at this point in the history
  • Loading branch information
elraphty committed Apr 17, 2024
1 parent c94681f commit 4439c2f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 6 additions & 3 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,16 +568,19 @@ func (db database) GetBountiesCount(r *http.Request) int64 {
func (db database) GetFilterStatusCount() FilterStattuCount {
var openCount int64
var assignedCount int64
var completedCount int64
var paidCount 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)

ms := FilterStattuCount{
Open: openCount,
Assigned: assignedCount,
Paid: paidCount,
Open: openCount,
Assigned: assignedCount,
Completed: completedCount,
Paid: paidCount,
}

return ms
Expand Down
7 changes: 4 additions & 3 deletions db/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,10 @@ type MetricsBountyCsv struct {
}

type FilterStattuCount struct {
Open int64 `json:"open"`
Assigned int64 `json:"assigned"`
Paid int64 `json:"paid"`
Open int64 `json:"open"`
Assigned int64 `json:"assigned"`
Completed int64 `json:"completed"`
Paid int64 `json:"paid"`
}

func (Person) TableName() string {
Expand Down

0 comments on commit 4439c2f

Please sign in to comment.