mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
fix: override is_transfer lookup for direct cut-over laying flocks
This commit is contained in:
@@ -318,6 +318,7 @@ func (u *ProjectflockController) LookupProjectFlockKandang(c *fiber.Ctx) error {
|
||||
dtoResult.IsTransition = isTransition
|
||||
dtoResult.IsLaying = isLaying
|
||||
}
|
||||
applyCutOverLayingLookupOverride(&dtoResult)
|
||||
if withPopulation {
|
||||
population := dtoResult.AvailableQuantity
|
||||
dtoResult.Population = &population
|
||||
@@ -344,6 +345,20 @@ func (u *ProjectflockController) LookupProjectFlockKandang(c *fiber.Ctx) error {
|
||||
Data: dtoResult})
|
||||
}
|
||||
|
||||
func applyCutOverLayingLookupOverride(result *dto.ProjectFlockKandangDTO) {
|
||||
if result == nil || result.ProjectFlock == nil || result.IsLaying || result.ChickInDate == nil {
|
||||
return
|
||||
}
|
||||
|
||||
category := strings.ToUpper(strings.TrimSpace(result.ProjectFlock.Category))
|
||||
if category != strings.ToUpper(string(utils.ProjectFlockCategoryLaying)) {
|
||||
return
|
||||
}
|
||||
|
||||
result.IsTransition = false
|
||||
result.IsLaying = true
|
||||
}
|
||||
|
||||
func (u *ProjectflockController) Resubmit(c *fiber.Ctx) error {
|
||||
param := c.Params("id")
|
||||
req := new(validation.Resubmit)
|
||||
|
||||
Reference in New Issue
Block a user