mirror of
https://github.com/simon987/task_tracker.git
synced 2025-12-11 14:08:52 +00:00
worker stats dashboard, fixed logs page, mobile support for navbar & project dashboard
This commit is contained in:
@@ -19,6 +19,11 @@ type Worker struct {
|
||||
Secret []byte `json:"secret"`
|
||||
}
|
||||
|
||||
type WorkerStats struct {
|
||||
Alias string `json:"alias"`
|
||||
ClosedTaskCount int64 `json:"closed_task_count"`
|
||||
}
|
||||
|
||||
func (database *Database) SaveWorker(worker *Worker) {
|
||||
|
||||
db := database.getDB()
|
||||
@@ -163,3 +168,19 @@ func (database *Database) UpdateWorker(worker *Worker) bool {
|
||||
|
||||
return rowsAffected == 1
|
||||
}
|
||||
|
||||
func (database *Database) GetAllWorkerStats() *[]WorkerStats {
|
||||
|
||||
db := database.getDB()
|
||||
rows, err := db.Query(`SELECT alias, closed_task_count FROM worker WHERE closed_task_count>0 LIMIT 50`)
|
||||
handleErr(err)
|
||||
|
||||
stats := make([]WorkerStats, 0)
|
||||
for rows.Next() {
|
||||
s := WorkerStats{}
|
||||
_ = rows.Scan(&s.Alias, &s.ClosedTaskCount)
|
||||
stats = append(stats, s)
|
||||
}
|
||||
|
||||
return &stats
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user