mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-22 14:25:45 +00:00
feat[BE]: Add GetClosingKeuanganByKandang endpoint and related service methods
This commit is contained in:
@@ -563,16 +563,15 @@ func (r *RecordingRepositoryImpl) GetTotalWeightProducedFromUniformityByProjectF
|
||||
|
||||
err := r.DB().WithContext(ctx).
|
||||
Table("project_flock_kandang_uniformity").
|
||||
Select("COALESCE(SUM(mean_weight * chick_qty_of_weight / 1000), 0) as total_weight").
|
||||
Select("COALESCE(SUM((mean_up / 1.10) * chick_qty_of_weight / 1000), 0) as total_weight").
|
||||
Joins("JOIN ("+
|
||||
" SELECT pfku.project_flock_kandang_id, MAX(pfku.id) as latest_id "+
|
||||
" FROM project_flock_kandang_uniformity pfku "+
|
||||
" JOIN project_flock_kandangs pfk ON pfk.id = pfku.project_flock_kandang_id "+
|
||||
" WHERE pfk.project_flock_id = ? "+
|
||||
" AND pfku.deleted_at IS NULL "+
|
||||
" GROUP BY pfku.project_flock_kandang_id "+
|
||||
") latest ON latest.project_flock_kandang_id = project_flock_kandang_uniformity.project_flock_kandang_id "+
|
||||
"AND project_flock_kandang_uniformity.id = latest.latest_id").
|
||||
"AND project_flock_kandang_uniformity.id = latest.latest_id", projectFlockID).
|
||||
Scan(&result).Error
|
||||
|
||||
return result.TotalWeight, err
|
||||
|
||||
Reference in New Issue
Block a user