1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: exclude unknown languages from leaderboard time

This commit is contained in:
Ferdinand Mütsch 2023-04-09 17:35:55 +02:00
parent a20456bb8e
commit dc4eefbede

View File

@ -223,11 +223,13 @@ func (srv *LeaderboardService) GenerateByUser(user *models.User, interval *model
return nil, err return nil, err
} }
// exclude unknown language (will also exclude browsing time by chrome-wakatime plugin)
total := summary.TotalTime() - summary.TotalTimeByKey(models.SummaryLanguage, models.UnknownSummaryKey)
return &models.LeaderboardItem{ return &models.LeaderboardItem{
User: user, User: user,
UserID: user.ID, UserID: user.ID,
Interval: (*interval)[0], Interval: (*interval)[0],
Total: summary.TotalTime(), Total: total,
}, nil }, nil
} }