chellow 1750591796.0.0__py3-none-any.whl → 1750675713.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
 
@@ -18,6 +18,7 @@ from chellow.utils import (
18
18
  hh_range,
19
19
  req_date,
20
20
  req_int,
21
+ to_ct,
21
22
  )
22
23
 
23
24
 
@@ -44,10 +45,11 @@ def content(user_id, report_run_id, contract_id, months_length, finish_date):
44
45
  )
45
46
  writer.writerow(titles)
46
47
 
48
+ finish_date_ct = to_ct(finish_date)
47
49
  months = list(
48
50
  c_months_u(
49
- finish_year=finish_date.year,
50
- finish_month=finish_date.month,
51
+ finish_year=finish_date_ct.year,
52
+ finish_month=finish_date_ct.month,
51
53
  months=months_length,
52
54
  )
53
55
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chellow
3
- Version: 1750591796.0.0
3
+ Version: 1750675713.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
@@ -109,7 +109,7 @@ chellow/reports/report_g_supplies_snapshot.py,sha256=9xB6RDrnbgxuomMcP1b1yEP4kOn
109
109
  chellow/reports/report_g_supply_virtual_bill.py,sha256=EaYrB8PHJIXrUuhiZ7dwUlbNBkuyJebQHrdc308_z1o,3653
110
110
  chellow/reports/report_g_virtual_bills.py,sha256=20vHa5LGQwOAlJlaGJaGszZrrbT0PMOZJf6hSxU2hIQ,4528
111
111
  chellow/reports/report_g_virtual_bills_hh.py,sha256=gaiLEmKTpq6JsfZ1p0SdCDuPvzvigXp6z88gHRCA63w,3416
112
- chellow/reports/report_missing_bills.py,sha256=3uWA6Wyskn30tUDOV_W6u_009flfKzua7vDh_jsBDaM,5956
112
+ chellow/reports/report_missing_bills.py,sha256=aCgpVpwjN7jKg1S_pnmnHgo9FKFFSThSkiEKAUYvtSo,6021
113
113
  chellow/reports/report_sscs.py,sha256=fQWyVG-gdg37DyNHgpNARpSxIwTl7mCn20fDLwx9oHg,3214
114
114
  chellow/reports/report_supply_contacts.py,sha256=pvwlInaPYV_pa9MMK6vh854plHFwv3m5zo5xulR1g5I,3599
115
115
  chellow/static/css/chellow.css,sha256=dnkuj9Z1BCOV_L2Y26lDd2QlTmFFhATa1YvwPVch1Oc,5375
@@ -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-1750591796.0.0.dist-info/METADATA,sha256=DRXh-odYMTSn96sdP_y_qaRPg7WlsxNGoWrnWVjiiow,12238
388
- chellow-1750591796.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
389
- chellow-1750591796.0.0.dist-info/RECORD,,
387
+ chellow-1750675713.0.0.dist-info/METADATA,sha256=u_m0k6YJsGsmxkP2OMuolkwQHXalamspQAjqTZ78H8c,12238
388
+ chellow-1750675713.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
389
+ chellow-1750675713.0.0.dist-info/RECORD,,