mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: support project query param for alltime endpoint
This commit is contained in:
@@ -44,9 +44,15 @@ func (h *CompatV1AllHandler) ApiGet(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
total := summary.TotalTime()
|
||||
vm := &v1.AllTimeVieModel{
|
||||
Data: &v1.AllTimeVieModelData{
|
||||
var total time.Duration
|
||||
if key := values.Get("project"); key != "" {
|
||||
total = summary.TotalTimeBy(models.SummaryProject, key)
|
||||
} else {
|
||||
total = summary.TotalTime()
|
||||
}
|
||||
|
||||
vm := &v1.AllTimeViewModel{
|
||||
Data: &v1.AllTimeViewModelData{
|
||||
Seconds: float32(total),
|
||||
Text: utils.FmtWakatimeDuration(total * time.Second),
|
||||
IsUpToDate: true,
|
||||
|
Reference in New Issue
Block a user