mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-22 22:35:43 +00:00
[FIX/BE-US-281] changes calculate fcr egg
This commit is contained in:
@@ -273,15 +273,15 @@ func (s dashboardService) buildPerformanceCharts(ctx context.Context, params *va
|
|||||||
weekFeed := weeklyFeedMap[week]
|
weekFeed := weeklyFeedMap[week]
|
||||||
|
|
||||||
actFcr := 0.0
|
actFcr := 0.0
|
||||||
if weekFeed > 0 {
|
if weekEgg > 0 {
|
||||||
actFcr = weekEgg / weekFeed
|
actFcr = weekFeed / weekEgg
|
||||||
}
|
}
|
||||||
|
|
||||||
cumEgg += weekEgg
|
cumEgg += weekEgg
|
||||||
cumFeed += weekFeed
|
cumFeed += weekFeed
|
||||||
actFcrCum := 0.0
|
actFcrCum := 0.0
|
||||||
if cumFeed > 0 {
|
if cumEgg > 0 {
|
||||||
actFcrCum = cumEgg / cumFeed
|
actFcrCum = cumFeed / cumEgg
|
||||||
}
|
}
|
||||||
|
|
||||||
bodyWeightDataset = append(bodyWeightDataset, map[string]interface{}{
|
bodyWeightDataset = append(bodyWeightDataset, map[string]interface{}{
|
||||||
@@ -359,10 +359,10 @@ func (s dashboardService) buildPerformanceCharts(ctx context.Context, params *va
|
|||||||
},
|
},
|
||||||
"fcr": {
|
"fcr": {
|
||||||
Series: []dto.DashboardChartSeriesDTO{
|
Series: []dto.DashboardChartSeriesDTO{
|
||||||
{Id: "act_fcr", Label: "Act. FCR", Unit: "%"},
|
{Id: "act_fcr", Label: "Act. FCR", Unit: "kg/kg"},
|
||||||
{Id: "std_fcr", Label: "STD. FCR", Unit: "%"},
|
{Id: "std_fcr", Label: "STD. FCR", Unit: "kg/kg"},
|
||||||
{Id: "act_fcr_cum", Label: "Act. FCR Cummulative", Unit: "%"},
|
{Id: "act_fcr_cum", Label: "Act. FCR Cummulative", Unit: "kg/kg"},
|
||||||
{Id: "std_fcr_cum", Label: "STD. FCR Cummulative", Unit: "%"},
|
{Id: "std_fcr_cum", Label: "STD. FCR Cummulative", Unit: "kg/kg"},
|
||||||
},
|
},
|
||||||
Dataset: fcrDataset,
|
Dataset: fcrDataset,
|
||||||
},
|
},
|
||||||
@@ -937,11 +937,11 @@ func (s dashboardService) fcrValue(ctx context.Context, filter *validation.Dashb
|
|||||||
}
|
}
|
||||||
feedUsageGrams := feedUsageToGrams(feedRows)
|
feedUsageGrams := feedUsageToGrams(feedRows)
|
||||||
|
|
||||||
if feedUsageGrams <= 0 {
|
if eggWeightGrams <= 0 {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return eggWeightGrams / feedUsageGrams, nil
|
return feedUsageGrams / eggWeightGrams, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s dashboardService) mortalityValue(ctx context.Context, filter *validation.DashboardFilter, startDate, endExclusive time.Time) (float64, error) {
|
func (s dashboardService) mortalityValue(ctx context.Context, filter *validation.DashboardFilter, startDate, endExclusive time.Time) (float64, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user