5.0.5: normalized для текущей недели в статистике
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m22s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m22s
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user