feat(BE-390): adjustment calculate dashboard

This commit is contained in:
ragilap
2026-01-11 18:35:23 +07:00
parent d40243be4b
commit a54129866e
2 changed files with 3 additions and 3 deletions
@@ -24,7 +24,7 @@ type FeedUsageByUom struct {
type RecordingWeeklyMetric struct {
Week int
HandDay float64
HenDay float64
EggWeight float64
FeedIntake float64
FcrValue float64
@@ -110,7 +110,7 @@ func (r *DashboardRepositoryImpl) GetRecordingWeeklyMetrics(ctx context.Context,
db := r.DB().WithContext(ctx).
Table("recordings AS r").
Select(`((r.day - 1) / 7 + 1) AS week,
COALESCE(AVG(r.hen_day), 0) AS hand_day,
COALESCE(AVG(r.hen_day), 0) AS hen_day,
COALESCE(AVG(r.egg_weight), 0) AS egg_weight,
COALESCE(AVG(r.feed_intake), 0) AS feed_intake,
COALESCE(AVG(r.fcr_value), 0) AS fcr_value,
@@ -288,7 +288,7 @@ func (s dashboardService) buildPerformanceCharts(ctx context.Context, params *va
performanceDataset = append(performanceDataset, map[string]interface{}{
"week": week,
"act_laying": roundTo(rec.HandDay, 2),
"act_laying": roundTo(rec.HenDay, 2),
"std_laying": roundTo(std.StdLaying, 2),
"act_egg_weight": roundTo(rec.EggWeight, 2),
"std_egg_weight": roundTo(std.StdEggWeight, 2),