mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 23:35:43 +00:00
feat(BE-390): adjustment calculate dashboard
This commit is contained in:
@@ -24,7 +24,7 @@ type FeedUsageByUom struct {
|
|||||||
|
|
||||||
type RecordingWeeklyMetric struct {
|
type RecordingWeeklyMetric struct {
|
||||||
Week int
|
Week int
|
||||||
HandDay float64
|
HenDay float64
|
||||||
EggWeight float64
|
EggWeight float64
|
||||||
FeedIntake float64
|
FeedIntake float64
|
||||||
FcrValue float64
|
FcrValue float64
|
||||||
@@ -110,7 +110,7 @@ func (r *DashboardRepositoryImpl) GetRecordingWeeklyMetrics(ctx context.Context,
|
|||||||
db := r.DB().WithContext(ctx).
|
db := r.DB().WithContext(ctx).
|
||||||
Table("recordings AS r").
|
Table("recordings AS r").
|
||||||
Select(`((r.day - 1) / 7 + 1) AS week,
|
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.egg_weight), 0) AS egg_weight,
|
||||||
COALESCE(AVG(r.feed_intake), 0) AS feed_intake,
|
COALESCE(AVG(r.feed_intake), 0) AS feed_intake,
|
||||||
COALESCE(AVG(r.fcr_value), 0) AS fcr_value,
|
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{}{
|
performanceDataset = append(performanceDataset, map[string]interface{}{
|
||||||
"week": week,
|
"week": week,
|
||||||
"act_laying": roundTo(rec.HandDay, 2),
|
"act_laying": roundTo(rec.HenDay, 2),
|
||||||
"std_laying": roundTo(std.StdLaying, 2),
|
"std_laying": roundTo(std.StdLaying, 2),
|
||||||
"act_egg_weight": roundTo(rec.EggWeight, 2),
|
"act_egg_weight": roundTo(rec.EggWeight, 2),
|
||||||
"std_egg_weight": roundTo(std.StdEggWeight, 2),
|
"std_egg_weight": roundTo(std.StdEggWeight, 2),
|
||||||
|
|||||||
Reference in New Issue
Block a user