This commit is contained in:
@@ -362,9 +362,10 @@ func (d *Database) DailyOrdersCount() (int64, error) {
|
|||||||
|
|
||||||
// ── Résumé global ────────────────────────────────────────────────────────────
|
// ── Résumé global ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
// TotalOrders renvoie le nombre total de commandes filtré par le reset "commandes".
|
// TotalOrders renvoie le nombre de commandes actives (même périmètre que le
|
||||||
|
// dashboard : pending/assigned/en_route/arrived/livre), filtré par le reset "commandes".
|
||||||
func (d *Database) TotalOrders(resetAt time.Time) (int64, error) {
|
func (d *Database) TotalOrders(resetAt time.Time) (int64, error) {
|
||||||
where, args := statusFilterClause("status != 'cancelled'", resetAt, "created_at")
|
where, args := statusFilterClause("status IN ('pending', 'assigned', 'en_route', 'arrived', 'livre')", resetAt, "created_at")
|
||||||
var total int64
|
var total int64
|
||||||
err := d.GDB.Raw(`SELECT COUNT(*) FROM commandes WHERE `+where, args...).Scan(&total).Error
|
err := d.GDB.Raw(`SELECT COUNT(*) FROM commandes WHERE `+where, args...).Scan(&total).Error
|
||||||
return total, err
|
return total, err
|
||||||
|
|||||||
Reference in New Issue
Block a user