chellow 1701963465.0.0__py3-none-any.whl → 1702999177.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
@@ -1552,6 +1552,7 @@ def era_edit_get(era_id):
1552
1552
  @e.route("/eras/<int:era_id>/edit/form")
1553
1553
  def era_edit_form_get(era_id):
1554
1554
  try:
1555
+ era = Era.get_by_id(g.sess, era_id)
1555
1556
  ct_now = ct_datetime_now()
1556
1557
  cops = g.sess.scalars(select(Cop).order_by(Cop.code))
1557
1558
  comms = g.sess.scalars(select(Comm).order_by(Comm.code))
@@ -1565,7 +1566,17 @@ def era_edit_form_get(era_id):
1565
1566
  else:
1566
1567
  start_date = to_utc(ct_datetime(ct_now.year, ct_now.month, ct_now.day))
1567
1568
 
1568
- era = Era.get_by_id(g.sess, era_id)
1569
+ is_ended = req_bool("is_ended")
1570
+ if is_ended:
1571
+ if "finish_year" in request.values:
1572
+ finish_date = req_hh_date("finish")
1573
+ elif era.finish_date is None:
1574
+ finish_date = start_date
1575
+ else:
1576
+ finish_date = era.finish_date
1577
+ else:
1578
+ finish_date = None
1579
+
1569
1580
  RateScriptAliasStart = aliased(RateScript)
1570
1581
  RateScriptAliasFinish = aliased(RateScript)
1571
1582
  mop_contracts = g.sess.scalars(
@@ -1703,20 +1714,26 @@ def era_edit_form_get(era_id):
1703
1714
  mtc_participant = None
1704
1715
 
1705
1716
  if pc.code == "00":
1706
- imp_llfcs = g.sess.scalars(
1717
+ imp_llfcs_q = (
1707
1718
  select(Llfc)
1708
1719
  .join(MtcLlfc)
1709
1720
  .where(
1710
1721
  MtcLlfc.mtc_participant == mtc_participant,
1711
1722
  start_date >= Llfc.valid_from,
1712
- Llfc.valid_to == null(),
1713
1723
  Llfc.is_import == true(),
1714
1724
  )
1715
1725
  .order_by(Llfc.code, Llfc.valid_from.desc())
1716
1726
  .distinct()
1717
1727
  )
1728
+ if finish_date is None:
1729
+ imp_llfcs_q = imp_llfcs_q.where(Llfc.valid_to == null())
1730
+ else:
1731
+ imp_llfcs_q = imp_llfcs_q.where(
1732
+ or_(Llfc.valid_to == null(), Llfc.valid_to >= finish_date)
1733
+ )
1734
+ imp_llfcs = g.sess.scalars(imp_llfcs_q)
1718
1735
 
1719
- exp_llfcs = g.sess.scalars(
1736
+ exp_llfcs_q = (
1720
1737
  select(Llfc)
1721
1738
  .join(MtcLlfc)
1722
1739
  .where(
@@ -1728,6 +1745,13 @@ def era_edit_form_get(era_id):
1728
1745
  .order_by(Llfc.code, Llfc.valid_from.desc())
1729
1746
  .distinct()
1730
1747
  )
1748
+ if finish_date is None:
1749
+ exp_llfcs_q = exp_llfcs_q.where(Llfc.valid_to == null())
1750
+ else:
1751
+ exp_llfcs_q = exp_llfcs_q.where(
1752
+ or_(Llfc.valid_to == null(), Llfc.valid_to >= finish_date)
1753
+ )
1754
+ exp_llfcs = g.sess.scalars(exp_llfcs_q)
1731
1755
  else:
1732
1756
  mtc_ssc = MtcSsc.find_by_values(g.sess, mtc_participant, ssc, start_date)
1733
1757
  imp_llfcs = g.sess.scalars(
@@ -1763,6 +1787,7 @@ def era_edit_form_get(era_id):
1763
1787
  return render_template(
1764
1788
  "era_edit_form.html",
1765
1789
  era=era,
1790
+ finish_date=finish_date,
1766
1791
  energisation_statuses=energisation_statuses,
1767
1792
  default_energisation_status=default_energisation_status,
1768
1793
  mop_contracts=mop_contracts,
@@ -436,7 +436,7 @@ def _process_site(
436
436
 
437
437
  supply_data["imp-mpan-core"] = imp_mpan_core
438
438
  supply_data["exp-mpan-core"] = exp_mpan_core
439
- supply_data["associated-site-ids"] |= era_associates
439
+ supply_data["associated-site-ids"].update(era_associates)
440
440
  supply_data["start-date"] = min(sss.start_date, supply_data["start-date"])
441
441
  supply_data["finish-date"] = max(
442
442
  sss.finish_date, supply_data["finish-date"]
@@ -666,8 +666,9 @@ def _process_site(
666
666
 
667
667
  era_rows.append([make_val(v) for v in out])
668
668
 
669
- for _, vals in sorted(supplies_data.items()):
670
- supply_rows.append(make_val(vals.get(t)) for t in supply_titles)
669
+ for _, v in sorted(supplies_data.items()):
670
+ row = [make_val(v.get(t)) for t in supply_titles]
671
+ supply_rows.append(row)
671
672
 
672
673
  site_md_used_kw = 0
673
674
  for hh in site.hh_data(sess, start_date, finish_date, exclude_virtual=True):
@@ -678,7 +679,7 @@ def _process_site(
678
679
  now,
679
680
  site.code,
680
681
  site.name,
681
- site.find_linked_sites(sess, start_date, finish_date),
682
+ [s.code for s in site.find_linked_sites(sess, start_date, finish_date)],
682
683
  start_date,
683
684
  finish_date,
684
685
  site_category,
@@ -19,7 +19,7 @@
19
19
 
20
20
  {% if request.values.is_ended == 'true' %}
21
21
  <label>Finish Date</label>
22
- {{input_date('finish', era.finish_date, is_dynamic=False)}}
22
+ {{input_date('finish', finish_date, is_dynamic=False)}}
23
23
  {% endif %}
24
24
 
25
25
  <label>MOP Contract</label>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chellow
3
- Version: 1701963465.0.0
3
+ Version: 1702999177.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)
@@ -34,7 +34,7 @@ chellow/e/scenario.py,sha256=1tUxnvwTzr6cKqiw2wphdv5XDzV6JO6UVYkyQa67vHs,23263
34
34
  chellow/e/system_price.py,sha256=F2GF_TNapfpbhoYjuGYAUCtD4JnccOUfd3w2ClG55qc,8032
35
35
  chellow/e/tlms.py,sha256=m6bUY1LNRlPoZ8va7Y3TlXAIktlTz36UVygFoDqwXIc,9586
36
36
  chellow/e/tnuos.py,sha256=Ry5Re7h5lOwzDgFRg4KhhFX1HMJ2vVWEwPJKYeESecs,20806
37
- chellow/e/views.py,sha256=-yEGDquRtL8TfcT7xViScnJ_kFFT4atJhZ3roagI82w,208235
37
+ chellow/e/views.py,sha256=pdqQtAjAsEK1Fk3Ongg8af5vlS25vEUauYCK2Dh99vA,209207
38
38
  chellow/e/bill_parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  chellow/e/bill_parsers/activity_mop_stark_xlsx.py,sha256=UgWXDPzQkQghyj_lfgBqoSJpHB-t-qOdSaB8qY6GLog,4071
40
40
  chellow/e/bill_parsers/annual_mop_stark_xlsx.py,sha256=-HMoIfa_utXYKA44RuC0Xqv3vd2HLeQU_4P0iBUd3WA,4219
@@ -81,7 +81,7 @@ chellow/reports/report_33.py,sha256=Dakqsl-2kGxl8rVnZuK2f0icIHKB0OlKs-6zoZ7kCMc,
81
81
  chellow/reports/report_387.py,sha256=cfEda5oL9j4Rbwh3PTw6FY6WwJT_It8MUZoSSqPMxyU,5793
82
82
  chellow/reports/report_41.py,sha256=3wNRv6yIAaI4zqM2lA1Fz-X706Hmc5vZSMvvfGmoPng,7571
83
83
  chellow/reports/report_429.py,sha256=zEFYcIw9bA9z7BHVoHRMnMOJt4OlTL4DJNsCX1yJEf0,12503
84
- chellow/reports/report_59.py,sha256=Broxh8-8SpkXCgmn2XV-Xnob5zAAUD_E5SsPHiDr-rw,44640
84
+ chellow/reports/report_59.py,sha256=sDDXflp6m46WVxUr2EP3bIpkDekXJ0xtvGzdLq2EDJM,44677
85
85
  chellow/reports/report_81.py,sha256=XrBLfuwLtMsn8EfoMaPRO92TKHsu_3MW95ynknDtF4I,4385
86
86
  chellow/reports/report_87.py,sha256=aqii485kbYZAvl7ajL1rGsC4eHbXAxbkGoazGwDJj0Q,5717
87
87
  chellow/reports/report_asset_comparison.py,sha256=6kHiPOL5fiZXtPyKXQ0fHvi1zYX51Frb4NMMDwLdWvc,6140
@@ -205,7 +205,7 @@ chellow/templates/e/em_totals.html,sha256=D_H12qF6b8heVeSGzcl4u7xRvtPLUtM1zWYrwE
205
205
  chellow/templates/e/energisation_status.html,sha256=hvD1qMpLYjmWWGIrv-5Ko3KbRL3a6MdQXcO3Fr4_cHA,478
206
206
  chellow/templates/e/energisation_statuses.html,sha256=qwRIH7jqKA1MgajsWOeZAH89iRpOfsNW_fAqXymUQ3E,587
207
207
  chellow/templates/e/era_edit.html,sha256=hW2_8Yt1n6VbT15a3PJ4Tn7wwVKyU-IkYDSLC1ZWCRQ,4022
208
- chellow/templates/e/era_edit_form.html,sha256=dd2AjxZjrKw01CCEBkXEQZ8biuep0APcOm1cYjgcG9I,4749
208
+ chellow/templates/e/era_edit_form.html,sha256=NhVp965vVnQw6fneGugkAc0nkojjUncbQdio6IeQwhE,4745
209
209
  chellow/templates/e/era_supplier_bill_add.html,sha256=TgcIFuX-_sXXYFsn9yGT-QqMrZe6uLxWoJ-G0f-VELU,2050
210
210
  chellow/templates/e/generator_type.html,sha256=En0lQSU_mc-QLMG5Hx-gDINVoqyfa4X9RYwopzpm33g,439
211
211
  chellow/templates/e/generator_types.html,sha256=672cXDYewLAk32pzp6c8fi2P48FikxRrzTEtx_PlR7Y,535
@@ -357,6 +357,6 @@ chellow/templates/g/supply_note_edit.html,sha256=6UQf_qbhFDys3cVsTp-c7ABWZpggW9R
357
357
  chellow/templates/g/supply_notes.html,sha256=WR3YwGh_qqTklSJ7JqWX6BKBc9rk_jMff4RiWZiF2CM,936
358
358
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
359
359
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
360
- chellow-1701963465.0.0.dist-info/METADATA,sha256=RGi21ZtVrdk78hDbhPj8X14ZhWr9jl_wu_xIfrXXABc,12160
361
- chellow-1701963465.0.0.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87
362
- chellow-1701963465.0.0.dist-info/RECORD,,
360
+ chellow-1702999177.0.0.dist-info/METADATA,sha256=n-t_5b5YhtN3u4JVBLMB28fU2zYztyaOExrN68FJTrA,12160
361
+ chellow-1702999177.0.0.dist-info/WHEEL,sha256=mRYSEL3Ih6g5a_CVMIcwiF__0Ae4_gLYh01YFNwiq1k,87
362
+ chellow-1702999177.0.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.18.0
2
+ Generator: hatchling 1.21.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any