chellow 1752836620.0.0__py3-none-any.whl → 1753106469.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
@@ -5714,20 +5714,34 @@ def supply_post(supply_id):
5714
5714
  if "new_msn" in request.form:
5715
5715
  start_date_str = req_str("start_date")
5716
5716
  start_date = parse_hh_start(start_date_str)
5717
+ if start_date is None:
5718
+ raise BadRequest("The data of the MSN change is blank in ECOES.")
5717
5719
 
5718
5720
  msn = req_str("msn")
5721
+ msg = ""
5719
5722
  era = supply.find_era_at(g.sess, start_date)
5720
5723
  if era is None:
5721
- raise BadRequest(f"There isn't an era at {start_date}")
5722
- if era.msn == msn:
5723
- raise BadRequest(f"The era at {start_date} already has the MSN {msn}")
5724
+ raise BadRequest(f"There are no eras from {start_date|hh_format}")
5725
+ else:
5726
+ if era.start_date != start_date:
5727
+ era = supply.insert_era_at(g.sess, start_date)
5728
+ g.sess.commit()
5729
+ for era in supply.find_eras(g.sess, start_date, None):
5730
+ if era.msn == msn:
5731
+ msg += (
5732
+ f"The era at {hh_format(era.start_date)} already has the "
5733
+ f"MSN {msn}. "
5734
+ )
5735
+ else:
5736
+ era.msn = msn
5724
5737
 
5725
- if era.start_date != start_date:
5726
- era = supply.insert_era_at(g.sess, start_date)
5727
- era.msn = msn
5728
- g.sess.commit()
5729
- flash("MSN updated successfully")
5730
- return render_template("supply_post.html")
5738
+ g.sess.commit()
5739
+ msg += (
5740
+ f"The era at {hh_format(era.start_date)} has been "
5741
+ f"successfully updated with the MSN {msn}. "
5742
+ )
5743
+ flash(msg)
5744
+ return render_template("supply_post.html")
5731
5745
 
5732
5746
  except BadRequest as e:
5733
5747
  flash(e.description)
chellow/models.py CHANGED
@@ -4271,16 +4271,16 @@ class Supply(Base, PersistentClass):
4271
4271
 
4272
4272
  def find_eras(self, sess, start, finish):
4273
4273
  eras = (
4274
- sess.query(Era)
4275
- .filter(
4274
+ select(Era)
4275
+ .where(
4276
4276
  Era.supply == self,
4277
4277
  or_(Era.finish_date == null(), Era.finish_date >= start),
4278
4278
  )
4279
4279
  .order_by(Era.start_date)
4280
4280
  )
4281
4281
  if finish is not None:
4282
- eras = eras.filter(Era.start_date <= finish)
4283
- return eras.all()
4282
+ eras = eras.where(Era.start_date <= finish)
4283
+ return sess.scalars(eras).all()
4284
4284
 
4285
4285
  def update_era(
4286
4286
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chellow
3
- Version: 1752836620.0.0
3
+ Version: 1753106469.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)
@@ -6,7 +6,7 @@ chellow/dloads.py,sha256=dixp-O0MF2_mlwrnKx3D9DH09Qu05BjTo0rZfigTjR4,5534
6
6
  chellow/edi_lib.py,sha256=alu20x9ZX06iPfnNI9dEJzuP6RIf4We3Y_M_bl7RrcY,51789
7
7
  chellow/fake_batch_updater.py,sha256=khAmvSUn9qN04w8C92kRg1UeyQvfLztE7QXv9tUz6nE,11611
8
8
  chellow/general_import.py,sha256=bm8FoaC9xUajGvJYShuS5GEwPwcL5eCF9D9g6o_AkB0,68089
9
- chellow/models.py,sha256=XD5wl3Pa8vZFGA0aB1Pu-xJs3iBoBoeX44E8Myho_68,244648
9
+ chellow/models.py,sha256=n6vjsY6jgY98gOY5MGzKuHEEhOs73Pr3XO-auLeQ3es,244656
10
10
  chellow/national_grid.py,sha256=-c_vqNRtpNIQOcm0F1NDhS3_QUiOaLgEJYWzysSNc5Y,4369
11
11
  chellow/proxy.py,sha256=cVXIktPlX3tQ1BYcwxq0nJXKE6r3DtFTtfFHPq55HaM,1351
12
12
  chellow/rate_server.py,sha256=fg-Pf_9Hk3bXmC9riPQNGQxBvLvBa_WtNYdwDCjnCSg,5678
@@ -44,7 +44,7 @@ chellow/e/system_price.py,sha256=6w5J7bzwFAZubE2zdOFRiS8IIrVP8hkoIOaG2yCt-Ic,623
44
44
  chellow/e/tlms.py,sha256=K2n-dF6qNW7VQp4m_sVK1HWnXarmAIzpotWXYqWQacY,9363
45
45
  chellow/e/tnuos.py,sha256=NBmc-f3oezrl4gviAKobljHfICTpBKxxxEGBGJi_lRk,4927
46
46
  chellow/e/triad.py,sha256=uQIngSrz8irBXQ0Rp_s8nAUzu-y2Ms7aj4B38_Ff8y8,13720
47
- chellow/e/views.py,sha256=e5rMZFT2fNO3P14_0nCyOEwNWnMiayx2wqo4PJmBwRM,220111
47
+ chellow/e/views.py,sha256=tCzoVreBLEcNmBDbWWqhQ3qIp-0v93dBhF8yoDeT9mI,220738
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=opjXRrqrgBTbSKzL0JfTLP0fnz3DL3oRZZ4P0DifQ3I,4119
50
50
  chellow/e/bill_parsers/annual_mop_stark_xlsx.py,sha256=-HMoIfa_utXYKA44RuC0Xqv3vd2HLeQU_4P0iBUd3WA,4219
@@ -385,6 +385,6 @@ chellow/templates/g/supply_note_edit.html,sha256=b8mB6_ucBwoljp03iy6AgVaZUhGw3-1
385
385
  chellow/templates/g/supply_notes.html,sha256=6epNmZ3NKdXZz27fvmRUGeffg_oc1kmwuBeyRzQe3Rg,854
386
386
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
387
387
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
388
- chellow-1752836620.0.0.dist-info/METADATA,sha256=r0CxGsqFVviRAdFYIzkcWwlvSYAO6E39BuqT11clQIk,12585
389
- chellow-1752836620.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
390
- chellow-1752836620.0.0.dist-info/RECORD,,
388
+ chellow-1753106469.0.0.dist-info/METADATA,sha256=YMm8-MduiWKqPWeENv_u33zI391ioRp-tDbKrowYsVo,12585
389
+ chellow-1753106469.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
390
+ chellow-1753106469.0.0.dist-info/RECORD,,