Skip to content

Commit

Permalink
Merge pull request #253 from gisce/62724_fix_for_crash_when_no_pcs
Browse files Browse the repository at this point in the history
check if there is pcs before division
  • Loading branch information
eberloso authored Sep 5, 2024
2 parents 32fe4e4 + 54bbf88 commit 0a543f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gestionatr/input/messages/B70.py
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ def get_lectures_info(self):
# Normalment es 1 pero pot no ser-ho. Aixó es una mandanga per no ahver de treballar amb la zeta.
consum_calculat_sefons_fomrula = round(vals['consum_m3'] * vals['pcs'] * vals['factor_k'], 3)
consum_calculat_segons_factor = round(vals['consum'], 3)
if consum_calculat_segons_factor != consum_calculat_sefons_fomrula:
if consum_calculat_segons_factor != consum_calculat_sefons_fomrula and vals['pcs']:
consum_calculat = round(vals['consum_m3'] * meter.factorconver, 3)
if consum_calculat_segons_factor == consum_calculat:
vals['factor_k'] = meter.factorconver / vals['pcs']
Expand All @@ -1400,7 +1400,7 @@ def get_lectures_info(self):
# ultima lectura
# Per tant: si el consum facturat per la distri no coincideix amb el consum calculat, ero aplicant
# el faactor de conversio del ultim dia siq ue aplica, recalculem el factor k perque quadri tot.
if consum_kwh_facturat != consum_calculat_segons_factor:
if consum_kwh_facturat != consum_calculat_segons_factor and vals['pcs']:
if not factor_ultima_lectura and self.meters[-1].factorconver:
factor_ultima_lectura = float(self.meters[-1].factorconver)
if factor_ultima_lectura:
Expand Down

0 comments on commit 0a543f2

Please sign in to comment.