chellow 1749578506.0.0__py3-none-any.whl → 1750597108.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.

chellow/e/views.py CHANGED
@@ -2172,54 +2172,7 @@ def era_edit_delete(era_id):
2172
2172
  return hx_redirect(f"/supplies/{supply.id}")
2173
2173
  except BadRequest as e:
2174
2174
  flash(e.description)
2175
- energisation_statuses = g.sess.query(EnergisationStatus).order_by(
2176
- EnergisationStatus.code
2177
- )
2178
- pcs = g.sess.query(Pc).order_by(Pc.code)
2179
- cops = g.sess.query(Cop).order_by(Cop.code)
2180
- comms = g.sess.execute(select(Comm).order_by(Comm.code)).scalars()
2181
- gsp_groups = g.sess.query(GspGroup).order_by(GspGroup.code)
2182
- mop_contracts = (
2183
- g.sess.query(Contract)
2184
- .join(MarketRole)
2185
- .filter(MarketRole.code == "M")
2186
- .order_by(Contract.name)
2187
- )
2188
- dc_contracts = (
2189
- g.sess.query(Contract)
2190
- .join(MarketRole)
2191
- .filter(MarketRole.code.in_(("C", "D")))
2192
- .order_by(Contract.name)
2193
- )
2194
- supplier_contracts = (
2195
- g.sess.query(Contract)
2196
- .join(MarketRole)
2197
- .filter(MarketRole.code == "X")
2198
- .order_by(Contract.name)
2199
- )
2200
- site_eras = (
2201
- g.sess.query(SiteEra)
2202
- .join(Site)
2203
- .filter(SiteEra.era == era)
2204
- .order_by(Site.code)
2205
- .all()
2206
- )
2207
- return make_response(
2208
- render_template(
2209
- "era_edit.html",
2210
- era=era,
2211
- pcs=pcs,
2212
- cops=cops,
2213
- comms=comms,
2214
- gsp_groups=gsp_groups,
2215
- mop_contracts=mop_contracts,
2216
- dc_contracts=dc_contracts,
2217
- supplier_contracts=supplier_contracts,
2218
- site_eras=site_eras,
2219
- energisation_statuses=energisation_statuses,
2220
- ),
2221
- 400,
2222
- )
2175
+ return hx_redirect(f"/eras/{era.id}/edit", code=307)
2223
2176
 
2224
2177
 
2225
2178
  @e.route("/eras/<int:era_id>/add_supplier_bill")
@@ -144,7 +144,7 @@ def run_import(sess, log, set_progress):
144
144
  ).one_or_none()
145
145
 
146
146
  if fake_batch is not None:
147
- log("Found existing fake batch")
147
+ log(f"Found existing fake batch {fake_batch_name}")
148
148
  first_fake_bill = sess.scalars(
149
149
  select(GBill)
150
150
  .where(GBill.g_batch == fake_batch)
@@ -157,10 +157,25 @@ def run_import(sess, log, set_progress):
157
157
  fake_batch.delete(sess)
158
158
  sess.flush()
159
159
  fake_batch = None
160
+ log(f"Deleted fake batch {fake_batch_name}")
160
161
 
161
162
  if fake_batch is None:
162
- log("Adding a new fake batch")
163
- fake_batch = g_contract.insert_g_batch(sess, fake_batch_name, "Fake Batch")
163
+ latest_bill = sess.scalars(
164
+ select(GBill)
165
+ .join(GBatch)
166
+ .where(GBatch.g_contract == g_contract)
167
+ .order_by(GBill.finish_date.desc())
168
+ ).first()
169
+ if latest_bill is None:
170
+ log(
171
+ "No actual bills found for this contract, so not creating fake "
172
+ "batch"
173
+ )
174
+ continue
175
+ if latest_bill.finish_date >= last_month_start:
176
+ log("Actual bills found in the last month, so not creating fake batch")
177
+ continue
178
+
164
179
  raw_bills = fb_func(
165
180
  sess,
166
181
  log,
@@ -170,6 +185,10 @@ def run_import(sess, log, set_progress):
170
185
  current_month_finish,
171
186
  )
172
187
  if raw_bills is not None and len(raw_bills) > 0:
188
+ log(f"Adding a new fake batch {fake_batch_name}")
189
+ fake_batch = g_contract.insert_g_batch(
190
+ sess, fake_batch_name, "Fake Batch"
191
+ )
173
192
  log("About to insert raw bills")
174
193
  for raw_bill in raw_bills:
175
194
  bill_type = BillType.get_by_code(sess, raw_bill["bill_type_code"])
@@ -213,6 +232,8 @@ def run_import(sess, log, set_progress):
213
232
  pres_type,
214
233
  )
215
234
  sess.commit()
235
+ else:
236
+ log("No raw bills available, so not adding fake batch")
216
237
  sess.commit()
217
238
 
218
239
 
@@ -32,6 +32,7 @@ SUPPLIER_CODE_MAP = {
32
32
  "MET": ("commodity", Decimal("100000"), Decimal("1000")),
33
33
  "CCL": ("ccl", Decimal("100000"), Decimal("1000")),
34
34
  "SUN": ("sundry", Decimal("1000"), Decimal("100")),
35
+ "ADJ": ("sundry", Decimal("1000"), Decimal("100")),
35
36
  }
36
37
 
37
38
  UNIT_MAP = {"M3": "M3", "HH": "HCUF", "HCUF": "HCUF"}
@@ -54,7 +55,7 @@ def _process_ADJ(elements, headers):
54
55
  def _process_BCD(elements, headers):
55
56
  ivdt = elements["IVDT"]
56
57
  headers["issue_date"] = to_date(ivdt[0])
57
-
58
+ headers["start_date"] = to_date(ivdt[0])
58
59
  invn = elements["INVN"]
59
60
  headers["reference"] = invn[0]
60
61
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chellow
3
- Version: 1749578506.0.0
3
+ Version: 1750597108.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)
@@ -4,7 +4,7 @@ chellow/bank_holidays.py,sha256=T_utYMwe_g1dz5X-aOTdIPryg49SvB7QsWM1yphlqG8,4423
4
4
  chellow/commands.py,sha256=ESBe9ZWj1c3vdZgqMZ9gFvYAB3hRag2R1PzOwuw9yFo,1302
5
5
  chellow/dloads.py,sha256=dixp-O0MF2_mlwrnKx3D9DH09Qu05BjTo0rZfigTjR4,5534
6
6
  chellow/edi_lib.py,sha256=alu20x9ZX06iPfnNI9dEJzuP6RIf4We3Y_M_bl7RrcY,51789
7
- chellow/fake_batch_updater.py,sha256=RH43yx0ndVM0xrMaNXdla_ZVMoyMp_zXzSvyt-jM62o,10759
7
+ chellow/fake_batch_updater.py,sha256=khAmvSUn9qN04w8C92kRg1UeyQvfLztE7QXv9tUz6nE,11611
8
8
  chellow/general_import.py,sha256=y8X-FzQJzVrfvVMyErNHns2MGI511KwDC19AjIX3nTk,65325
9
9
  chellow/models.py,sha256=XD5wl3Pa8vZFGA0aB1Pu-xJs3iBoBoeX44E8Myho_68,244648
10
10
  chellow/national_grid.py,sha256=-c_vqNRtpNIQOcm0F1NDhS3_QUiOaLgEJYWzysSNc5Y,4369
@@ -44,7 +44,7 @@ chellow/e/system_price.py,sha256=6w5J7bzwFAZubE2zdOFRiS8IIrVP8hkoIOaG2yCt-Ic,623
44
44
  chellow/e/tlms.py,sha256=Wb9ZuxscMzxXs0FT06Iu5YXeccmO6ai_mUjnJGJwTM4,9045
45
45
  chellow/e/tnuos.py,sha256=NBmc-f3oezrl4gviAKobljHfICTpBKxxxEGBGJi_lRk,4927
46
46
  chellow/e/triad.py,sha256=lIQj7EdUrcFwEqleuHZXYU_bfzIwNOqUVVxB3NPQt4A,13710
47
- chellow/e/views.py,sha256=i_AGJgJf7MZPNHwVUrEnzOoxSO3qIag7ZG8pNVC6xCE,220822
47
+ chellow/e/views.py,sha256=jNm52QtQLUcm25WEy480Lj5gyJnCnxyUSpAeYSWHCew,219257
48
48
  chellow/e/bill_parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
49
  chellow/e/bill_parsers/activity_mop_stark_xlsx.py,sha256=UgWXDPzQkQghyj_lfgBqoSJpHB-t-qOdSaB8qY6GLog,4071
50
50
  chellow/e/bill_parsers/annual_mop_stark_xlsx.py,sha256=-HMoIfa_utXYKA44RuC0Xqv3vd2HLeQU_4P0iBUd3WA,4219
@@ -69,7 +69,7 @@ chellow/gas/bill_import.py,sha256=w0lPgK_Drzh8rtnEBQe3qFuxrgzZ6qQSgpaGrrGznMU,65
69
69
  chellow/gas/bill_parser_bgs_xlsx.py,sha256=PxjFMEB91QcGvyarCc9qHfO3-Rs_Twdo9iJU9uBYfa4,7834
70
70
  chellow/gas/bill_parser_csv.py,sha256=Ecdy-apFT-mWAxddAsM4k1s-9-FpIaOfjP0oFc0rdQg,5557
71
71
  chellow/gas/bill_parser_engie_edi.py,sha256=Ko0vZP-QdVQ1uuhS_5cdrii60_cM4b_LFJMoY0pZqnk,8950
72
- chellow/gas/bill_parser_total_edi.py,sha256=bMAeIkzHwNhv0qdKYXtRl-tzUUYtjNkbM3PMl3NurFc,11225
72
+ chellow/gas/bill_parser_total_edi.py,sha256=8HZH5Le24bVNFDc7vaKbauMaYR-n9P6u0ZG7gDdqbIA,11325
73
73
  chellow/gas/ccl.py,sha256=DMlcPUELZi00CaDekVJINYk3GgH5apFrImVdmkbyba0,2913
74
74
  chellow/gas/cv.py,sha256=4cdYYQ8Qak6NeYdBCB4YaQ0jX8-UkaydIIdibCQuXxM,7344
75
75
  chellow/gas/dn_rate_parser.py,sha256=pmdYcqcvx8lt65Qt0dLLPi5igSET336KA0NBlNYYRTA,11378
@@ -384,6 +384,6 @@ chellow/templates/g/supply_note_edit.html,sha256=b8mB6_ucBwoljp03iy6AgVaZUhGw3-1
384
384
  chellow/templates/g/supply_notes.html,sha256=6epNmZ3NKdXZz27fvmRUGeffg_oc1kmwuBeyRzQe3Rg,854
385
385
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
386
386
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
387
- chellow-1749578506.0.0.dist-info/METADATA,sha256=r1rdOVxN8vmPARj1gB5KrUW3L6CIITU0AaFYVL7Zlag,12238
388
- chellow-1749578506.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
389
- chellow-1749578506.0.0.dist-info/RECORD,,
387
+ chellow-1750597108.0.0.dist-info/METADATA,sha256=SnpCk6v8Tc0NBAR7edsSmoofholqC6gS3KQcAxcsuwE,12238
388
+ chellow-1750597108.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
389
+ chellow-1750597108.0.0.dist-info/RECORD,,