diff --git a/internal/modules/closings/services/closing.service.go b/internal/modules/closings/services/closing.service.go index 47e30a7f..ddf52b49 100644 --- a/internal/modules/closings/services/closing.service.go +++ b/internal/modules/closings/services/closing.service.go @@ -538,7 +538,7 @@ func (s closingService) GetClosingDataProduksi(c *fiber.Ctx, projectFlockID uint var population float64 for _, history := range project.KandangHistory { for _, chickin := range history.Chickins { - population += chickin.UsageQty + chickin.PendingUsageQty + population += chickin.UsageQty } } diff --git a/internal/modules/repports/services/repport.service.go b/internal/modules/repports/services/repport.service.go index 9f54fad8..ebf68867 100644 --- a/internal/modules/repports/services/repport.service.go +++ b/internal/modules/repports/services/repport.service.go @@ -318,7 +318,8 @@ func mapRecordingToProductionResultDTO(record entity.Recording) dto.ProductionRe result.Fi = float64(*record.CumIntake) } - avgWeight := calculateAverageBodyWeight(record.BodyWeights) + // avgWeight := calculateAverageBodyWeight(record.BodyWeights) + avgWeight := 1.0 if avgWeight > 0 { result.Bw = avgWeight } @@ -350,25 +351,25 @@ func mapRecordingToProductionResultDTO(record entity.Recording) dto.ProductionRe return result } -func calculateAverageBodyWeight(bodyWeights []entity.RecordingBW) float64 { - var totalQty float64 - var totalWeight float64 +// func calculateAverageBodyWeight(bodyWeights []entity.RecordingBW) float64 { +// var totalQty float64 +// var totalWeight float64 - for _, bw := range bodyWeights { - totalQty += bw.Qty - if bw.TotalWeight > 0 { - totalWeight += bw.TotalWeight - } else { - totalWeight += bw.AvgWeight * bw.Qty - } - } +// for _, bw := range bodyWeights { +// totalQty += bw.Qty +// if bw.TotalWeight > 0 { +// totalWeight += bw.TotalWeight +// } else { +// totalWeight += bw.AvgWeight * bw.Qty +// } +// } - if totalQty == 0 { - return 0 - } +// if totalQty == 0 { +// return 0 +// } - return totalWeight / totalQty -} +// return totalWeight / totalQty +// } type eggSummary struct { TotalQty int64