[FIX/BE-US] adjustment recording

This commit is contained in:
ragilap
2026-01-15 15:42:57 +07:00
parent 7f2401311b
commit f1032b44d1
2 changed files with 17 additions and 13 deletions
@@ -279,9 +279,14 @@ func (u *ProjectflockController) LookupProjectFlockKandang(c *fiber.Ctx) error {
if err != nil {
return err
}
_ = availableStock
dtoResult := dto.ToProjectFlockKandangDTO(*result)
dtoResult.AvailableQuantity = float64(availableStock)
if population, err := u.ProjectflockService.GetProjectFlockKandangPopulation(c, result.Id); err != nil {
return err
} else {
dtoResult.AvailableQuantity = population
}
if warehouse, werr := u.ProjectflockService.GetWarehouseByKandangID(c, result.KandangId); werr != nil {
return werr
} else if warehouse != nil {
@@ -289,10 +294,7 @@ func (u *ProjectflockController) LookupProjectFlockKandang(c *fiber.Ctx) error {
dtoResult.Warehouse = &mapped
}
if withPopulation {
population, err := u.ProjectflockService.GetProjectFlockKandangPopulation(c, result.Id)
if err != nil {
return err
}
population := dtoResult.AvailableQuantity
dtoResult.Population = &population
}