adjust take weight remaining

This commit is contained in:
giovanni
2026-01-24 12:03:09 +07:00
parent f69321d9cd
commit 8b1831fc73
@@ -1576,18 +1576,18 @@ func (s *repportService) GetHppPerKandang(ctx *fiber.Ctx) (*dto.HppPerKandangRes
return nil, nil, err
}
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
}
}
// 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))
@@ -1673,7 +1673,7 @@ func (s *repportService) GetHppPerKandang(ctx *fiber.Ctx) (*dto.HppPerKandangRes
}
var eggPiecesFloatRemaining float64
eggRemainingWeightFloatRemaining := row.EggProductionWeightKgRemaining
var eggRemainingWeightFloatRemaining float64
var eggTotalPiecesFloat float64
var eggWeightFloat float64
eggHpp := 0.0
@@ -1683,7 +1683,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