5.0.5: normalized для текущей недели в статистике
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m22s

This commit is contained in:
poignatov
2026-02-09 14:52:45 +03:00
parent 7012f1c8ed
commit 1f5f3299f8
3 changed files with 15 additions and 6 deletions

View File

@@ -6785,8 +6785,12 @@ func (a *App) getFullStatisticsHandler(w http.ResponseWriter, r *http.Request) {
if item.ReportYear == currentYearInt && item.ReportWeek == currentWeekInt {
if score, exists := currentWeekScores[projectID]; exists {
item.TotalScore = score
// Для текущей недели normalized_total_score не отправляем
item.NormalizedTotalScore = 0
// Нормализованный score для текущей недели — та же логика, что в MV: LEAST(score, max)
if item.MaxGoalScore > 0 {
item.NormalizedTotalScore = math.Min(score, item.MaxGoalScore)
} else {
item.NormalizedTotalScore = score
}
}
}
@@ -6847,14 +6851,19 @@ func (a *App) getFullStatisticsHandler(w http.ResponseWriter, r *http.Request) {
totalScore = score
}
// Для текущей недели normalized_total_score не отправляем
// Нормализованный score для текущей недели — та же логика, что в MV: LEAST(score, max)
normalizedScore := totalScore
if maxGoalScore > 0 {
normalizedScore = math.Min(totalScore, maxGoalScore)
}
_, weekISO := time.Now().ISOWeek()
item := FullStatisticsItem{
ProjectName: projectName,
ReportYear: time.Now().Year(),
ReportWeek: weekISO,
TotalScore: totalScore,
NormalizedTotalScore: 0,
NormalizedTotalScore: normalizedScore,
MinGoalScore: minGoalScore,
MaxGoalScore: maxGoalScore,
Color: projectColor,