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 item.ReportYear == currentYearInt && item.ReportWeek == currentWeekInt {
|
||||||
if score, exists := currentWeekScores[projectID]; exists {
|
if score, exists := currentWeekScores[projectID]; exists {
|
||||||
item.TotalScore = score
|
item.TotalScore = score
|
||||||
// Для текущей недели normalized_total_score не отправляем
|
// Нормализованный score для текущей недели — та же логика, что в MV: LEAST(score, max)
|
||||||
item.NormalizedTotalScore = 0
|
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
|
totalScore = score
|
||||||
}
|
}
|
||||||
|
|
||||||
// Для текущей недели normalized_total_score не отправляем
|
// Нормализованный score для текущей недели — та же логика, что в MV: LEAST(score, max)
|
||||||
|
normalizedScore := totalScore
|
||||||
|
if maxGoalScore > 0 {
|
||||||
|
normalizedScore = math.Min(totalScore, maxGoalScore)
|
||||||
|
}
|
||||||
|
|
||||||
_, weekISO := time.Now().ISOWeek()
|
_, weekISO := time.Now().ISOWeek()
|
||||||
item := FullStatisticsItem{
|
item := FullStatisticsItem{
|
||||||
ProjectName: projectName,
|
ProjectName: projectName,
|
||||||
ReportYear: time.Now().Year(),
|
ReportYear: time.Now().Year(),
|
||||||
ReportWeek: weekISO,
|
ReportWeek: weekISO,
|
||||||
TotalScore: totalScore,
|
TotalScore: totalScore,
|
||||||
NormalizedTotalScore: 0,
|
NormalizedTotalScore: normalizedScore,
|
||||||
MinGoalScore: minGoalScore,
|
MinGoalScore: minGoalScore,
|
||||||
MaxGoalScore: maxGoalScore,
|
MaxGoalScore: maxGoalScore,
|
||||||
Color: projectColor,
|
Color: projectColor,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "play-life-web",
|
"name": "play-life-web",
|
||||||
"version": "5.0.4",
|
"version": "5.0.5",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
Reference in New Issue
Block a user