fix report doc initial count logic
This commit is contained in:
1 parent
53316cfd49
commit
c45b6656ae
3 files changed
+107
-17
No files matched your search
@@ -321,7 +321,10 @@ class Command(BaseCommand):
|
||||
harvest_day_accum += harvest_today * age
|
||||
harvest_wt_accum += harvest_today * harvest_wt_today
|
||||
|
||||
# --- manual input ----------------------------------------------
|
||||
mort_today = MORTALITY[i]
|
||||
mort_total_after = mort_total + mort_today
|
||||
life = DOC_IN_COUNT - mort_total_after - harvest_total
|
||||
life_pct = life / DOC_IN_COUNT * 100.0 if DOC_IN_COUNT else 0.0
|
||||
# Running averages: flock weight before the first harvest, then the
|
||||
# harvest-weighted running mean carried forward on idle days.
|
||||
if harvest_today:
|
||||
@@ -334,11 +337,9 @@ class Command(BaseCommand):
|
||||
avg_hday = harvest_day_accum / harvest_total
|
||||
avg_hwt = harvest_wt_accum / harvest_total
|
||||
|
||||
life = DOC_IN_COUNT - mort_total - harvest_total
|
||||
lot_weight_g = life * weight if weight else 0.0
|
||||
denom = harvest_weight_total + lot_weight_g
|
||||
fcr = (feed_total * 50_000) / denom if denom > 0 else 0.0
|
||||
life_pct = (DOC_IN_COUNT - mort_total) / DOC_IN_COUNT * 100.0
|
||||
if avg_hday > 0 and fcr > 0:
|
||||
eef = life_pct * (avg_hwt / 1000.0) / (fcr * avg_hday) * 100.0
|
||||
else:
|
||||
@@ -349,8 +350,8 @@ class Command(BaseCommand):
|
||||
date=day,
|
||||
defaults={
|
||||
"age_manual": age,
|
||||
"mortality_manual": MORTALITY[i],
|
||||
"mortality_manual_total": mort_total,
|
||||
"mortality_manual": mort_today,
|
||||
"mortality_manual_total": mort_total_after,
|
||||
"feed_in_manual": in_today,
|
||||
"feed_in_manual_total": feed_in_total,
|
||||
"feed_use_manual": feed_today,
|
||||
@@ -376,8 +377,8 @@ class Command(BaseCommand):
|
||||
date=day,
|
||||
defaults={
|
||||
"age": age,
|
||||
"mortality": MORTALITY[i],
|
||||
"mortality_total": mort_total,
|
||||
"mortality": mort_today,
|
||||
"mortality_total": mort_total_after,
|
||||
"feed": feed_today,
|
||||
"feed_total": feed_total,
|
||||
"harvest": harvest_today,
|
||||
@@ -398,7 +399,7 @@ class Command(BaseCommand):
|
||||
},
|
||||
)
|
||||
|
||||
mort_total += MORTALITY[i]
|
||||
mort_total = mort_total_after
|
||||
|
||||
# --- IoT panel: Kandang 2 sensors with per-house jitter -------------
|
||||
panel_count = 0
|
||||
|
||||
Reference in new issue
Block a user