mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 15:25:43 +00:00
codex/fix: dashboard independent recording values without uniformity
This commit is contained in:
@@ -274,10 +274,10 @@ func (s dashboardService) buildPerformanceCharts(ctx context.Context, params *va
|
|||||||
cumFeed := 0.0
|
cumFeed := 0.0
|
||||||
|
|
||||||
for _, week := range weeks {
|
for _, week := range weeks {
|
||||||
rec := recordingMap[week]
|
rec, hasRec := recordingMap[week]
|
||||||
uni := uniformityMap[week]
|
uni, hasUni := uniformityMap[week]
|
||||||
std := standardMap[week]
|
std, hasStd := standardMap[week]
|
||||||
stdFcr := standardFcrMap[week]
|
stdFcr, hasStdFcr := standardFcrMap[week]
|
||||||
weekEgg := weeklyEggMap[week]
|
weekEgg := weeklyEggMap[week]
|
||||||
weekFeed := weeklyFeedMap[week]
|
weekFeed := weeklyFeedMap[week]
|
||||||
|
|
||||||
@@ -293,37 +293,69 @@ func (s dashboardService) buildPerformanceCharts(ctx context.Context, params *va
|
|||||||
actFcrCum = cumFeed / cumEgg
|
actFcrCum = cumFeed / cumEgg
|
||||||
}
|
}
|
||||||
|
|
||||||
bodyWeightDataset = append(bodyWeightDataset, map[string]interface{}{
|
bodyWeightRow := map[string]interface{}{
|
||||||
"week": week,
|
"week": week,
|
||||||
"body_weight": roundTo(uni.AverageWeight, 2),
|
}
|
||||||
"std_body_weight": roundTo(std.StdBodyWeight, 2),
|
if hasUni {
|
||||||
})
|
bodyWeightRow["body_weight"] = roundTo(uni.AverageWeight, 2)
|
||||||
|
}
|
||||||
|
if hasStd {
|
||||||
|
bodyWeightRow["std_body_weight"] = roundTo(std.StdBodyWeight, 2)
|
||||||
|
}
|
||||||
|
if len(bodyWeightRow) > 1 {
|
||||||
|
bodyWeightDataset = append(bodyWeightDataset, bodyWeightRow)
|
||||||
|
}
|
||||||
|
|
||||||
performanceDataset = append(performanceDataset, map[string]interface{}{
|
performanceRow := map[string]interface{}{
|
||||||
"week": week,
|
"week": week,
|
||||||
"act_laying": roundTo(rec.HenDay, 2),
|
}
|
||||||
"std_laying": roundTo(std.StdLaying, 2),
|
if hasRec {
|
||||||
"act_egg_weight": roundTo(rec.EggWeight, 2),
|
performanceRow["act_laying"] = roundTo(rec.HenDay, 2)
|
||||||
"std_egg_weight": roundTo(std.StdEggWeight, 2),
|
performanceRow["act_egg_weight"] = roundTo(rec.EggWeight, 2)
|
||||||
"act_feed_intake": roundTo(rec.FeedIntake, 2),
|
performanceRow["act_feed_intake"] = roundTo(rec.FeedIntake, 2)
|
||||||
"std_feed_intake": roundTo(std.StdFeedIntake, 2),
|
}
|
||||||
"act_uniformity": roundTo(uni.Uniformity, 2),
|
if hasUni {
|
||||||
"std_uniformity": roundTo(std.StdUniformity, 2),
|
performanceRow["act_uniformity"] = roundTo(uni.Uniformity, 2)
|
||||||
})
|
}
|
||||||
|
if hasStd {
|
||||||
|
performanceRow["std_laying"] = roundTo(std.StdLaying, 2)
|
||||||
|
performanceRow["std_egg_weight"] = roundTo(std.StdEggWeight, 2)
|
||||||
|
performanceRow["std_feed_intake"] = roundTo(std.StdFeedIntake, 2)
|
||||||
|
performanceRow["std_uniformity"] = roundTo(std.StdUniformity, 2)
|
||||||
|
}
|
||||||
|
if len(performanceRow) > 1 {
|
||||||
|
performanceDataset = append(performanceDataset, performanceRow)
|
||||||
|
}
|
||||||
|
|
||||||
fcrDataset = append(fcrDataset, map[string]interface{}{
|
fcrRow := map[string]interface{}{
|
||||||
"week": week,
|
"week": week,
|
||||||
"act_fcr": roundTo(actFcr, 2),
|
}
|
||||||
"std_fcr": roundTo(stdFcr, 2),
|
if weekEgg > 0 && weekFeed > 0 {
|
||||||
"act_fcr_cum": roundTo(actFcrCum, 2),
|
fcrRow["act_fcr"] = roundTo(actFcr, 2)
|
||||||
"std_fcr_cum": roundTo(stdFcr, 2),
|
}
|
||||||
})
|
if cumEgg > 0 && cumFeed > 0 {
|
||||||
|
fcrRow["act_fcr_cum"] = roundTo(actFcrCum, 2)
|
||||||
|
}
|
||||||
|
if hasStdFcr {
|
||||||
|
fcrRow["std_fcr"] = roundTo(stdFcr, 2)
|
||||||
|
fcrRow["std_fcr_cum"] = roundTo(stdFcr, 2)
|
||||||
|
}
|
||||||
|
if len(fcrRow) > 1 {
|
||||||
|
fcrDataset = append(fcrDataset, fcrRow)
|
||||||
|
}
|
||||||
|
|
||||||
deplesiDataset = append(deplesiDataset, map[string]interface{}{
|
deplesiRow := map[string]interface{}{
|
||||||
"week": week,
|
"week": week,
|
||||||
"act_deplesi": roundTo(rec.CumDepletionRate, 2),
|
}
|
||||||
"std_deplesi": roundTo(std.StdDepletion, 2),
|
if hasRec {
|
||||||
})
|
deplesiRow["act_deplesi"] = roundTo(rec.CumDepletionRate, 2)
|
||||||
|
}
|
||||||
|
if hasStd {
|
||||||
|
deplesiRow["std_deplesi"] = roundTo(std.StdDepletion, 2)
|
||||||
|
}
|
||||||
|
if len(deplesiRow) > 1 {
|
||||||
|
deplesiDataset = append(deplesiDataset, deplesiRow)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qualityRows, err := s.Repository.GetEggQualityWeeklyMetrics(ctx, startDate, endExclusive, filter)
|
qualityRows, err := s.Repository.GetEggQualityWeeklyMetrics(ctx, startDate, endExclusive, filter)
|
||||||
|
|||||||
Reference in New Issue
Block a user