4.16.3: Добавлен normalized_total_score в прогресс недель
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m32s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m32s
This commit is contained in:
@@ -210,13 +210,14 @@ type ProjectPriorityRequest struct {
|
||||
}
|
||||
|
||||
type FullStatisticsItem struct {
|
||||
ProjectName string `json:"project_name"`
|
||||
ReportYear int `json:"report_year"`
|
||||
ReportWeek int `json:"report_week"`
|
||||
TotalScore float64 `json:"total_score"`
|
||||
MinGoalScore float64 `json:"min_goal_score"`
|
||||
MaxGoalScore float64 `json:"max_goal_score"`
|
||||
Color string `json:"color"`
|
||||
ProjectName string `json:"project_name"`
|
||||
ReportYear int `json:"report_year"`
|
||||
ReportWeek int `json:"report_week"`
|
||||
TotalScore float64 `json:"total_score"`
|
||||
MinGoalScore float64 `json:"min_goal_score"`
|
||||
MaxGoalScore float64 `json:"max_goal_score"`
|
||||
NormalizedTotalScore float64 `json:"normalized_total_score"`
|
||||
Color string `json:"color"`
|
||||
}
|
||||
|
||||
type TodayEntryNode struct {
|
||||
@@ -6306,6 +6307,9 @@ func (a *App) getFullStatisticsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
-- Фактический score: COALESCE(NULL, 0.0000)
|
||||
COALESCE(wr.total_score, 0.0000) AS total_score,
|
||||
|
||||
-- Normalized score из MV
|
||||
COALESCE(wr.normalized_total_score, 0.0000) AS normalized_total_score,
|
||||
|
||||
-- Минимальная цель: COALESCE(NULL, 0.0000)
|
||||
COALESCE(wg.min_goal_score, 0.0000) AS min_goal_score,
|
||||
|
||||
@@ -6353,6 +6357,7 @@ func (a *App) getFullStatisticsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
&item.ReportYear,
|
||||
&item.ReportWeek,
|
||||
&item.TotalScore,
|
||||
&item.NormalizedTotalScore,
|
||||
&item.MinGoalScore,
|
||||
&item.MaxGoalScore,
|
||||
&projectID,
|
||||
@@ -6368,9 +6373,16 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
// Если normalized_total_score равен total_score, не отправляем его
|
||||
if item.NormalizedTotalScore == item.TotalScore {
|
||||
item.NormalizedTotalScore = 0
|
||||
}
|
||||
|
||||
statistics = append(statistics, item)
|
||||
}
|
||||
|
||||
@@ -6423,15 +6435,17 @@ func (a *App) getFullStatisticsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
totalScore = score
|
||||
}
|
||||
|
||||
// Для текущей недели normalized_total_score не отправляем
|
||||
_, weekISO := time.Now().ISOWeek()
|
||||
item := FullStatisticsItem{
|
||||
ProjectName: projectName,
|
||||
ReportYear: time.Now().Year(),
|
||||
ReportWeek: weekISO,
|
||||
TotalScore: totalScore,
|
||||
MinGoalScore: minGoalScore,
|
||||
MaxGoalScore: maxGoalScore,
|
||||
Color: projectColor,
|
||||
ProjectName: projectName,
|
||||
ReportYear: time.Now().Year(),
|
||||
ReportWeek: weekISO,
|
||||
TotalScore: totalScore,
|
||||
NormalizedTotalScore: 0,
|
||||
MinGoalScore: minGoalScore,
|
||||
MaxGoalScore: maxGoalScore,
|
||||
Color: projectColor,
|
||||
}
|
||||
statistics = append(statistics, item)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user