chellow 1720006293.0.0__py3-none-any.whl → 1720526317.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of chellow might be problematic. Click here for more details.

@@ -102,6 +102,7 @@ def content(g_batch_id, g_bill_id, g_contract_id, start_date, finish_date, user_
102
102
  _process_g_bill_ids(
103
103
  sess,
104
104
  report_context,
105
+ g_contract,
105
106
  g_bill_ids,
106
107
  forecast_date,
107
108
  bill_titles,
@@ -122,6 +123,7 @@ def content(g_batch_id, g_bill_id, g_contract_id, start_date, finish_date, user_
122
123
  def _process_g_bill_ids(
123
124
  sess,
124
125
  report_context,
126
+ g_contract,
125
127
  g_bill_ids,
126
128
  forecast_date,
127
129
  bill_titles,
@@ -132,15 +134,24 @@ def _process_g_bill_ids(
132
134
  g_bill_id = list(sorted(g_bill_ids))[0]
133
135
  g_bill_ids.remove(g_bill_id)
134
136
  g_bill = sess.query(GBill).filter(GBill.id == g_bill_id).one()
135
- problem = ""
136
137
  g_supply = g_bill.g_supply
138
+ vals = {
139
+ "covered_vat_gbp": Decimal("0.00"),
140
+ "covered_net_gbp": Decimal("0.00"),
141
+ "covered_gross_gbp": Decimal("0.00"),
142
+ "covered_kwh": Decimal(0),
143
+ "covered_start": g_bill.start_date,
144
+ "covered_finish": g_bill.finish_date,
145
+ "covered_bill_ids": [],
146
+ "virtual_problem": "",
147
+ }
137
148
  read_dict = defaultdict(set)
138
149
  for g_read in g_bill.g_reads:
139
150
  if not all(
140
151
  g_read.msn == era.msn
141
152
  for era in g_supply.find_g_eras(sess, g_read.prev_date, g_read.pres_date)
142
153
  ):
143
- problem += (
154
+ vals["virtual_problem"] += (
144
155
  f"The MSN {g_read.msn} of the register read {g_read.id} doesn't match "
145
156
  f"the MSN of all the relevant eras."
146
157
  )
@@ -152,17 +163,9 @@ def _process_g_bill_ids(
152
163
  typ_set = read_dict[str(dt) + "-" + g_read.msn]
153
164
  typ_set.add(typ)
154
165
  if len(typ_set) > 1:
155
- problem += f" Reads taken on {dt} have differing read types."
156
-
157
- vals = {
158
- "covered_vat_gbp": Decimal("0.00"),
159
- "covered_net_gbp": Decimal("0.00"),
160
- "covered_gross_gbp": Decimal("0.00"),
161
- "covered_kwh": Decimal(0),
162
- "covered_start": g_bill.start_date,
163
- "covered_finish": g_bill.finish_date,
164
- "covered_bill_ids": [],
165
- }
166
+ vals[
167
+ "virtual_problem"
168
+ ] += f" Reads taken on {dt} have differing read types."
166
169
 
167
170
  covered_primary_bill = None
168
171
  enlarged = True
@@ -270,12 +273,19 @@ def _process_g_bill_ids(
270
273
  or_(GEra.finish_date == null(), GEra.finish_date >= vals["covered_start"]),
271
274
  )
272
275
  ).scalars():
276
+ if g_era.g_contract != g_contract:
277
+ vals[
278
+ "virtual_problem"
279
+ ] += "The contract of the bill is different from the contract of the era."
280
+ continue
273
281
  site = (
274
282
  sess.query(Site)
275
283
  .join(SiteGEra)
276
284
  .filter(SiteGEra.is_physical == true(), SiteGEra.g_era == g_era)
277
285
  .one()
278
286
  )
287
+ vals["site_code"] = site.code
288
+ vals["site_name"] = site.name
279
289
 
280
290
  chunk_start = hh_max(vals["covered_start"], g_era.start_date)
281
291
  chunk_finish = hh_min(vals["covered_finish"], g_era.finish_date)
@@ -314,8 +324,6 @@ def _process_g_bill_ids(
314
324
  vals["bill_finish_date"] = g_bill.finish_date
315
325
  vals["mprn"] = g_supply.mprn
316
326
  vals["supply_name"] = g_supply.name
317
- vals["site_code"] = site.code
318
- vals["site_name"] = site.name
319
327
 
320
328
  for k, v in vals.items():
321
329
  if k == "covered_bill_ids":
@@ -332,9 +340,7 @@ def _process_g_bill_ids(
332
340
  except KeyError:
333
341
  vals[title] = None
334
342
 
335
- csv_writer.writerow(
336
- [(vals.get(k) if vals.get(k) is not None else "") for k in titles]
337
- )
343
+ csv_writer.writerow([csv_make_val(vals.get(k)) for k in titles])
338
344
 
339
345
 
340
346
  def do_get(sess):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: chellow
3
- Version: 1720006293.0.0
3
+ Version: 1720526317.0.0
4
4
  Summary: Web Application for checking UK energy bills.
5
5
  Project-URL: Homepage, https://github.com/WessexWater/chellow
6
6
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
@@ -83,7 +83,7 @@ chellow/reports/report_291.py,sha256=rqBXy6s7hMeYWw-yNX6w_L5t2yz6rNEeos_4xO7wf90
83
83
  chellow/reports/report_33.py,sha256=laVz-itDbJTdvC6LxLEeuY0eKpYx43Un4adiExPTEEE,16730
84
84
  chellow/reports/report_387.py,sha256=kmBZopb0AOivcowO2nPjRj6LnV0_QjCDXLwqPL7IGVE,5672
85
85
  chellow/reports/report_41.py,sha256=QQeTshA1Og7N3wPaoZ8ynJzwsvZ1mgSFc7DDkVqIZoM,7447
86
- chellow/reports/report_429.py,sha256=0GCc0rQnOSG0fusw69yMMOCxnWApBd3P2sGWIg1py9M,12359
86
+ chellow/reports/report_429.py,sha256=8WlLqyfMyvIF5Kc6CE0MKwcT5xwmR_Ao99Ef72yAOVc,12668
87
87
  chellow/reports/report_59.py,sha256=CCFPUspUFgoMt6sMFsdtLYW-inA9rN6D-6Kted6vskA,45458
88
88
  chellow/reports/report_81.py,sha256=f7sKPZUbl2VDbDHIg7B5rMDxcx_xnV1Y6PbjJyiTPLA,5609
89
89
  chellow/reports/report_87.py,sha256=j2gdBOapaVY1ZnlNlw14RPx58_k8eUkc3oRSnKuCsNA,7057
@@ -364,6 +364,6 @@ chellow/templates/g/supply_note_edit.html,sha256=b8mB6_ucBwoljp03iy6AgVaZUhGw3-1
364
364
  chellow/templates/g/supply_notes.html,sha256=6epNmZ3NKdXZz27fvmRUGeffg_oc1kmwuBeyRzQe3Rg,854
365
365
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
366
366
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
367
- chellow-1720006293.0.0.dist-info/METADATA,sha256=4Fg3yXTfYZ7JKwEwREZI72dTqsSTGAwudXblzYPbCUY,12205
368
- chellow-1720006293.0.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
369
- chellow-1720006293.0.0.dist-info/RECORD,,
367
+ chellow-1720526317.0.0.dist-info/METADATA,sha256=iyZrZ95p6OGYA8F9VMGixtiqBwF6NGri0JHZNnUJL_Y,12205
368
+ chellow-1720526317.0.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
369
+ chellow-1720526317.0.0.dist-info/RECORD,,