chellow 1711032714.0.0__py3-none-any.whl → 1712589951.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
@@ -1569,7 +1569,6 @@ def era_edit_form_get(era_id):
1569
1569
  try:
1570
1570
  era = Era.get_by_id(g.sess, era_id)
1571
1571
  ct_now = ct_datetime_now()
1572
- cops = g.sess.scalars(select(Cop).order_by(Cop.code))
1573
1572
  comms = g.sess.scalars(select(Comm).order_by(Comm.code))
1574
1573
  energisation_statuses = g.sess.scalars(
1575
1574
  select(EnergisationStatus).order_by(EnergisationStatus.code)
@@ -1781,6 +1780,11 @@ def era_edit_form_get(era_id):
1781
1780
  else:
1782
1781
  mtc_participant = None
1783
1782
 
1783
+ if mtc_participant is None:
1784
+ cops = g.sess.scalars(select(Cop).order_by(Cop.code))
1785
+ else:
1786
+ cops = Cop.get_valid(g.sess, mtc_participant.meter_type)
1787
+
1784
1788
  if pc.code == "00":
1785
1789
  imp_llfcs_q = (
1786
1790
  select(Llfc)
chellow/models.py CHANGED
@@ -510,6 +510,17 @@ class Cop(Base, PersistentClass):
510
510
  raise BadRequest(f"The CoP with code {code} can't be found.")
511
511
  return typ
512
512
 
513
+ @staticmethod
514
+ def get_valid(sess, meter_type):
515
+
516
+ if meter_type.code == "C5":
517
+ q = select(Cop).where(Cop.code.in_(["1", "2", "3", "4", "5"]))
518
+ elif meter_type.code in ["6A", "6B", "6C", "6D"]:
519
+ q = select(Cop).where(Cop.code == meter_type.code.lower())
520
+ else:
521
+ q = select(Cop)
522
+ return sess.scalars(q.order_by(Cop.code))
523
+
513
524
  __tablename__ = "cop"
514
525
  id = Column(Integer, primary_key=True)
515
526
  code = Column(String, unique=True, nullable=False)
@@ -3700,12 +3711,9 @@ class Era(Base, PersistentClass):
3700
3711
  f"{hh_format(finish_date)}."
3701
3712
  )
3702
3713
 
3703
- if (
3704
- self.mtc_participant.meter_type.code == "C5"
3705
- and cop.code not in ["1", "2", "3", "4", "5"]
3706
- or self.mtc_participant.meter_type.code in ["6A", "6B", "6C", "6D"]
3707
- and cop.code.upper() != self.mtc_participant.meter_type.code
3708
- ):
3714
+ if cop.code not in [
3715
+ c.code for c in Cop.get_valid(sess, self.mtc_participant.meter_type)
3716
+ ]:
3709
3717
  raise BadRequest(
3710
3718
  f"The CoP of {cop.code} is not compatible with the meter type code "
3711
3719
  f"of {self.mtc_participant.meter_type.code}."
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: chellow
3
- Version: 1711032714.0.0
3
+ Version: 1712589951.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)
@@ -5,7 +5,7 @@ chellow/commands.py,sha256=ESBe9ZWj1c3vdZgqMZ9gFvYAB3hRag2R1PzOwuw9yFo,1302
5
5
  chellow/dloads.py,sha256=5SmP-0QPK6xCkd_wjIWh_8FAzN5OxNHCzyEQ1Xb-Y-M,5256
6
6
  chellow/edi_lib.py,sha256=het3R0DBGtXEo-Sy1zvXQuX9EWQ1X6Y33G4l1hYYuds,51859
7
7
  chellow/general_import.py,sha256=4LduwzNipxOiHYHQLb0x96_m3RPuDnQMbJzOFDbOqTg,65039
8
- chellow/models.py,sha256=5ZWG1IexWNfwdq_ZlAjTyl0BlG2w682ydF09pEl31CY,237109
8
+ chellow/models.py,sha256=j26jxohyZ09tWVOAnWRFl0k0QUVRX0nDthIIDJpo7cE,237327
9
9
  chellow/national_grid.py,sha256=uxcv0qisHPyzw9AVIYPzsRqwt2XPAcZL-SBR12qcrS0,4364
10
10
  chellow/proxy.py,sha256=cVXIktPlX3tQ1BYcwxq0nJXKE6r3DtFTtfFHPq55HaM,1351
11
11
  chellow/rate_server.py,sha256=vNuKzlr0lkAzZ4zG7zboStoo92_6iLKAxbw1yZ-ucII,5626
@@ -38,7 +38,7 @@ chellow/e/system_price.py,sha256=3cPWohHmmBI9v7fENLBzXQkpAeC3r0s5xV29Nmr6k_E,583
38
38
  chellow/e/tlms.py,sha256=kHAy2A2d1Mma7x4GdNDyrzscJd5DpJtDBYiZEg241Dw,8538
39
39
  chellow/e/tnuos.py,sha256=KoMPJDIXfE4zwhSDuywGF1ooxjTYLVjtF7BkSFm6X24,4158
40
40
  chellow/e/triad.py,sha256=S6LEMHvUKhAZe0-yfLIRciYDZ8IKMn1jh1TmmsbQD3s,13588
41
- chellow/e/views.py,sha256=aZecpfM1sVn3xMwlKuiw9pE2f6s4uyd98obQXToKtqA,212466
41
+ chellow/e/views.py,sha256=p-zQa24HtNVLTHILqfiZ8UrixuljHSC163SrJuLQ3Ik,212590
42
42
  chellow/e/bill_parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  chellow/e/bill_parsers/activity_mop_stark_xlsx.py,sha256=UgWXDPzQkQghyj_lfgBqoSJpHB-t-qOdSaB8qY6GLog,4071
44
44
  chellow/e/bill_parsers/annual_mop_stark_xlsx.py,sha256=-HMoIfa_utXYKA44RuC0Xqv3vd2HLeQU_4P0iBUd3WA,4219
@@ -361,6 +361,6 @@ chellow/templates/g/supply_note_edit.html,sha256=6UQf_qbhFDys3cVsTp-c7ABWZpggW9R
361
361
  chellow/templates/g/supply_notes.html,sha256=WR3YwGh_qqTklSJ7JqWX6BKBc9rk_jMff4RiWZiF2CM,936
362
362
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
363
363
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
364
- chellow-1711032714.0.0.dist-info/METADATA,sha256=a9YFyBU_CMj0Zl39q_J8IwXQcQDRiNh70Yy8jR0QjEQ,12203
365
- chellow-1711032714.0.0.dist-info/WHEEL,sha256=bq9SyP5NxIRA9EpQgMCd-9RmPHWvbH-4lTDGwxgIR64,87
366
- chellow-1711032714.0.0.dist-info/RECORD,,
364
+ chellow-1712589951.0.0.dist-info/METADATA,sha256=7i4xrwuQ86GNArcYRVjMgd8c2k9pbTy5yW8XWSKvrTY,12203
365
+ chellow-1712589951.0.0.dist-info/WHEEL,sha256=as-1oFTWSeWBgyzh0O_qF439xqBe6AbBgt4MfYe5zwY,87
366
+ chellow-1712589951.0.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.22.3
2
+ Generator: hatchling 1.22.5
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any