fix hpp harian kandang

This commit is contained in:
giovanni
2026-01-23 10:01:48 +07:00
parent 0d585a99a6
commit fb565ef728
3 changed files with 27 additions and 30 deletions
@@ -1515,18 +1515,18 @@ func (s *repportService) GetHppPerKandang(ctx *fiber.Ctx) (*dto.HppPerKandangRes
return nil, nil, err
}
// eggMap, err := s.HppPerKandangRepo.GetEggProductionByProjectFlockKandangIDs(ctx.Context(), startOfDay, endOfDay, validPfkIDs)
// if err != nil {
// return nil, nil, err
// }
// for pfkID, egg := range eggMap {
// if rowIdx, ok := pfkIndex[pfkID]; ok {
// repoRows[rowIdx].EggProductionWeightKgRemaining = egg.EggProductionWeightKgRemaining
// repoRows[rowIdx].EggProductionPiecesRemaining = egg.EggProductionPiecesRemaining
// repoRows[rowIdx].EggProductionTotalWeightKg = egg.EggProductionTotalWeightKg
// repoRows[rowIdx].EggProductionTotalPieces = egg.EggProductionTotalPieces
// }
// }
eggMap, err := s.HppPerKandangRepo.GetWeightRemainingByProjectFlockKandangIDs(ctx.Context(), startOfDay, endOfDay, validPfkIDs)
if err != nil {
return nil, nil, err
}
for pfkID, egg := range eggMap {
if rowIdx, ok := pfkIndex[pfkID]; ok {
repoRows[rowIdx].EggProductionWeightKgRemaining = egg.EggProductionWeightKgRemaining
// repoRows[rowIdx].EggProductionPiecesRemaining = egg.EggProductionPiecesRemaining
// repoRows[rowIdx].EggProductionTotalWeightKg = egg.EggProductionTotalWeightKg
// repoRows[rowIdx].EggProductionTotalPieces = egg.EggProductionTotalPieces
}
}
}
costMap := make(map[uint]HppCostAggregate, len(costRows))
@@ -1612,7 +1612,7 @@ func (s *repportService) GetHppPerKandang(ctx *fiber.Ctx) (*dto.HppPerKandangRes
}
var eggPiecesFloatRemaining float64
var eggRemainingWeightFloatRemaining float64
eggRemainingWeightFloatRemaining := row.EggProductionWeightKgRemaining
var eggTotalPiecesFloat float64
var eggWeightFloat float64
eggHpp := 0.0
@@ -1622,7 +1622,7 @@ func (s *repportService) GetHppPerKandang(ctx *fiber.Ctx) (*dto.HppPerKandangRes
return nil, nil, err
}
if hppCost != nil {
eggRemainingWeightFloatRemaining = hppCost.Estimation.Kg - hppCost.Real.Kg
// eggRemainingWeightFloatRemaining = hppCost.Estimation.Kg - hppCost.Real.Kg
eggPiecesFloatRemaining = hppCost.Estimation.Butir - hppCost.Real.Butir
eggHpp = hppCost.Estimation.HargaKg
eggTotalPiecesFloat = hppCost.Estimation.Butir