mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-23 06:45:43 +00:00
Merge branch 'dev/gio' into 'development'
fix init population See merge request mbugroup/lti-api!135
This commit is contained in:
@@ -538,7 +538,7 @@ func (s closingService) GetClosingDataProduksi(c *fiber.Ctx, projectFlockID uint
|
|||||||
var population float64
|
var population float64
|
||||||
for _, history := range project.KandangHistory {
|
for _, history := range project.KandangHistory {
|
||||||
for _, chickin := range history.Chickins {
|
for _, chickin := range history.Chickins {
|
||||||
population += chickin.UsageQty + chickin.PendingUsageQty
|
population += chickin.UsageQty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -318,7 +318,8 @@ func mapRecordingToProductionResultDTO(record entity.Recording) dto.ProductionRe
|
|||||||
result.Fi = float64(*record.CumIntake)
|
result.Fi = float64(*record.CumIntake)
|
||||||
}
|
}
|
||||||
|
|
||||||
avgWeight := calculateAverageBodyWeight(record.BodyWeights)
|
// avgWeight := calculateAverageBodyWeight(record.BodyWeights)
|
||||||
|
avgWeight := 1.0
|
||||||
if avgWeight > 0 {
|
if avgWeight > 0 {
|
||||||
result.Bw = avgWeight
|
result.Bw = avgWeight
|
||||||
}
|
}
|
||||||
@@ -350,25 +351,25 @@ func mapRecordingToProductionResultDTO(record entity.Recording) dto.ProductionRe
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func calculateAverageBodyWeight(bodyWeights []entity.RecordingBW) float64 {
|
// func calculateAverageBodyWeight(bodyWeights []entity.RecordingBW) float64 {
|
||||||
var totalQty float64
|
// var totalQty float64
|
||||||
var totalWeight float64
|
// var totalWeight float64
|
||||||
|
|
||||||
for _, bw := range bodyWeights {
|
// for _, bw := range bodyWeights {
|
||||||
totalQty += bw.Qty
|
// totalQty += bw.Qty
|
||||||
if bw.TotalWeight > 0 {
|
// if bw.TotalWeight > 0 {
|
||||||
totalWeight += bw.TotalWeight
|
// totalWeight += bw.TotalWeight
|
||||||
} else {
|
// } else {
|
||||||
totalWeight += bw.AvgWeight * bw.Qty
|
// totalWeight += bw.AvgWeight * bw.Qty
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if totalQty == 0 {
|
// if totalQty == 0 {
|
||||||
return 0
|
// return 0
|
||||||
}
|
// }
|
||||||
|
|
||||||
return totalWeight / totalQty
|
// return totalWeight / totalQty
|
||||||
}
|
// }
|
||||||
|
|
||||||
type eggSummary struct {
|
type eggSummary struct {
|
||||||
TotalQty int64
|
TotalQty int64
|
||||||
|
|||||||
Reference in New Issue
Block a user