chellow 1715329858.0.0__py3-none-any.whl → 1715873476.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.

@@ -7,7 +7,7 @@ from dateutil.relativedelta import relativedelta
7
7
 
8
8
  from flask import g
9
9
 
10
- from sqlalchemy.sql.expression import true
10
+ from sqlalchemy.sql.expression import false, select, true
11
11
 
12
12
  from chellow.dloads import open_file
13
13
  from chellow.models import (
@@ -21,11 +21,11 @@ from chellow.models import (
21
21
  Supply,
22
22
  User,
23
23
  )
24
- from chellow.utils import csv_make_val, hh_before, req_int, utc_datetime_now
24
+ from chellow.utils import csv_make_val, hh_before, req_bool, req_int, utc_datetime_now
25
25
  from chellow.views import chellow_redirect
26
26
 
27
27
 
28
- def content(contract_id, days_hidden, user_id):
28
+ def content(contract_id, days_hidden, is_ignored, user_id):
29
29
  f = writer = None
30
30
  try:
31
31
  with Session() as sess:
@@ -54,15 +54,14 @@ def content(contract_id, days_hidden, user_id):
54
54
 
55
55
  now = utc_datetime_now()
56
56
  cutoff_date = now - relativedelta(days=days_hidden)
57
-
58
- for snag, channel, era, supply, site_era, site in (
59
- sess.query(Snag, Channel, Era, Supply, SiteEra, Site)
57
+ q = (
58
+ select(Snag, Channel, Era, Supply, SiteEra, Site)
60
59
  .join(Channel, Snag.channel_id == Channel.id)
61
60
  .join(Era, Channel.era_id == Era.id)
62
61
  .join(Supply, Era.supply_id == Supply.id)
63
62
  .join(SiteEra, Era.site_eras)
64
63
  .join(Site, SiteEra.site_id == Site.id)
65
- .filter(
64
+ .where(
66
65
  SiteEra.is_physical == true(),
67
66
  Era.dc_contract == contract,
68
67
  Snag.start_date < cutoff_date,
@@ -76,7 +75,11 @@ def content(contract_id, days_hidden, user_id):
76
75
  Snag.start_date,
77
76
  Snag.id,
78
77
  )
79
- ):
78
+ )
79
+ if not is_ignored:
80
+ q = q.where(Snag.is_ignored == false())
81
+
82
+ for snag, channel, era, supply, site_era, site in sess.execute(q):
80
83
  snag_start = snag.start_date
81
84
  snag_finish = snag.finish_date
82
85
  imp_mc = "" if era.imp_mpan_core is None else era.imp_mpan_core
@@ -123,7 +126,8 @@ def content(contract_id, days_hidden, user_id):
123
126
  def do_get(sess):
124
127
  contract_id = req_int("dc_contract_id")
125
128
  days_hidden = req_int("days_hidden")
129
+ is_ignored = req_bool("is_ignored")
126
130
 
127
- args = contract_id, days_hidden, g.user.id
131
+ args = contract_id, days_hidden, is_ignored, g.user.id
128
132
  threading.Thread(target=content, args=args).start()
129
133
  return chellow_redirect("/downloads", 303)
@@ -166,7 +166,7 @@ def _process_site(
166
166
  "imp-mpan-core": "displaced",
167
167
  "site-code": site.code,
168
168
  "site-name": site.name,
169
- "associated-site-ids": set(),
169
+ "associated-site-codes": set(),
170
170
  "source": "displaced",
171
171
  "supply-name": "displaced",
172
172
  },
@@ -211,7 +211,7 @@ def _process_site(
211
211
  "finish-date": main_ss.finish_date,
212
212
  "site-code": site.code,
213
213
  "site-name": site.name,
214
- "associated-site-ids": set(),
214
+ "associated-site-codes": set(),
215
215
  },
216
216
  )
217
217
 
@@ -405,7 +405,7 @@ def _process_site(
405
405
 
406
406
  vals["imp-mpan-core"] = imp_mpan_core
407
407
  vals["exp-mpan-core"] = exp_mpan_core
408
- vals["associated-site-ids"] = era_associates
408
+ vals["associated-site-codes"] = era_associates
409
409
  vals["era-start-date"] = sss.era.start_date
410
410
  vals["era-finish-date"] = sss.era.finish_date
411
411
  vals["imp-supplier-contract"] = imp_supplier_contract_name
@@ -435,7 +435,7 @@ def _process_site(
435
435
 
436
436
  supply_data["imp-mpan-core"] = imp_mpan_core
437
437
  supply_data["exp-mpan-core"] = exp_mpan_core
438
- supply_data["associated-site-ids"].update(era_associates)
438
+ supply_data["associated-site-codes"].update(era_associates)
439
439
  supply_data["start-date"] = min(sss.start_date, supply_data["start-date"])
440
440
  supply_data["finish-date"] = max(
441
441
  sss.finish_date, supply_data["finish-date"]
@@ -844,9 +844,9 @@ def content(
844
844
  "finish-date",
845
845
  "imp-mpan-core",
846
846
  "exp-mpan-core",
847
- "site-id",
847
+ "site-code",
848
848
  "site-name",
849
- "associated-site-ids",
849
+ "associated-site-codes",
850
850
  "era-start-date",
851
851
  "era-finish-date",
852
852
  "imp-supplier-contract",
@@ -870,7 +870,7 @@ def content(
870
870
  "exp-mpan-core",
871
871
  "site-code",
872
872
  "site-name",
873
- "associated-site-ids",
873
+ "associated-site-codes",
874
874
  "source",
875
875
  "generator-type",
876
876
  "supply-name",
@@ -881,9 +881,9 @@ def content(
881
881
  ]
882
882
  site_header_titles = [
883
883
  "creation-date",
884
- "site-id",
884
+ "site-code",
885
885
  "site-name",
886
- "associated-site-ids",
886
+ "associated-site-codes",
887
887
  "start-date",
888
888
  "finish-date",
889
889
  "metering-type",
@@ -17,7 +17,8 @@
17
17
  <legend>Download CSV</legend>
18
18
  <input type="hidden" name="dc_contract_id" value="{{contract.id}}">
19
19
  <label>Hide snags &lt; days old</label>
20
- <input size="3" maxlength="3" name="days_hidden" value="0">
20
+ {{input_text('days_hidden', '0', 3, 3)}}
21
+ <label>Include ignored snags</label> {{input_checkbox('is_ignored', False)}}
21
22
  <input type="submit" value="Download">
22
23
  </fieldset>
23
24
  </form>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: chellow
3
- Version: 1715329858.0.0
3
+ Version: 1715873476.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)
@@ -74,7 +74,7 @@ chellow/reports/report_183.py,sha256=DZX-hHJPl_Tbgkt31C_cuLZg_5L2b6iCPQ5foOZizR0
74
74
  chellow/reports/report_187.py,sha256=UvpaYHjyJFNV5puYq8_KxfzoBtVrwFgIGUOmC5oGA9A,9956
75
75
  chellow/reports/report_219.py,sha256=o2eEg3mX9_raP2b4gjc2Gu4vqnMqcvvJBYQ1oQjxvpE,6637
76
76
  chellow/reports/report_231.py,sha256=gOb1AkXZQvwVpRg5cIenO7iR7Se1_zsWnJp9l2BlgpA,5008
77
- chellow/reports/report_233.py,sha256=DLAmkoHFKH-N8OEIoX4jeCxAaCfJK0e7ssjFJJpPqzw,4334
77
+ chellow/reports/report_233.py,sha256=cIatj-HHYW_GNIRsji-DlsmYjt8rUdm_5xujPLOYL8U,4537
78
78
  chellow/reports/report_241.py,sha256=AlFmSHnfG2HWv_ICmWX7fNpPwLHjq7mo1QtOTjSKO3k,5384
79
79
  chellow/reports/report_247.py,sha256=ozgCcee8XeqYbOpZCyU2STJKaz6h2x7TYQogagTaYLw,46626
80
80
  chellow/reports/report_29.py,sha256=KDFjgrLBv4WbG9efCdu_geMR7gT_QV9N97Wfdt7aDc4,2736
@@ -83,7 +83,7 @@ chellow/reports/report_33.py,sha256=laVz-itDbJTdvC6LxLEeuY0eKpYx43Un4adiExPTEEE,
83
83
  chellow/reports/report_387.py,sha256=KcClrEOK5IRvePp0Jgbzs1Gwf-_CqYmEtFFlXrr_Z3E,5670
84
84
  chellow/reports/report_41.py,sha256=QQeTshA1Og7N3wPaoZ8ynJzwsvZ1mgSFc7DDkVqIZoM,7447
85
85
  chellow/reports/report_429.py,sha256=0GCc0rQnOSG0fusw69yMMOCxnWApBd3P2sGWIg1py9M,12359
86
- chellow/reports/report_59.py,sha256=21uNlcuYQCOAvrRir241HR-6SsuL9bWEPVCcU_jOxfE,44731
86
+ chellow/reports/report_59.py,sha256=d3qosO0s0y7xsn4i-ZGQLF420Zaax0lYI2KnolIPNi8,44749
87
87
  chellow/reports/report_81.py,sha256=UYr0Dm4TmCCYUbIWw3hWNI0GdQRhH27vwVk3Ytdsrcg,5288
88
88
  chellow/reports/report_87.py,sha256=ZadBo40rUORN0Fi926-dDHeTFn6L-fBzp3b4k7v5MdY,6802
89
89
  chellow/reports/report_asset_comparison.py,sha256=UN298MHuzyUDUiiZr7F_Ua6SrdVOlFLjgKjnIbrA-14,6118
@@ -158,7 +158,7 @@ chellow/templates/e/channel_add.html,sha256=X1hi0b-ZjchlQ2m7uZYCyqkqU-Qd1s3_5u4z
158
158
  chellow/templates/e/channel_edit.html,sha256=OUkdiS2NBQ_w4gmxRxXAcRToM5BT8DWWJrtQMFs-GUU,2198
159
159
  chellow/templates/e/channel_snag.html,sha256=wBJ5KBfeJdAeRmaB0qu0AD9Z4nM5fn6tJ_8bNqTWtoo,1477
160
160
  chellow/templates/e/channel_snag_edit.html,sha256=sUFI4Ml3F1B35x8_t_Pz3hWuQN9Xtxr3kt4u8hdxNwY,1911
161
- chellow/templates/e/channel_snags.html,sha256=57bVmu2SwetdpWQbImMykO-qgY7wXi6Y9plRqykOGy4,2901
161
+ chellow/templates/e/channel_snags.html,sha256=tDZWp8s0gt5AtqArpclSl6hOafQCetz7Sp4MfZJ7dWQ,2964
162
162
  chellow/templates/e/comm.html,sha256=DSlAaDg1r4KYq9VUgDtt2lgW6apZjZvwhMujIJINmps,383
163
163
  chellow/templates/e/comms.html,sha256=bUXZePnMfpKk1E71qLGOSkx8r3GxdPPD_-MosIXXq4s,434
164
164
  chellow/templates/e/cop.html,sha256=ULv7ALFJHMUgPX96hQNm2irc3edtKYHS6fYAxvmzj8M,376
@@ -363,6 +363,6 @@ chellow/templates/g/supply_note_edit.html,sha256=6UQf_qbhFDys3cVsTp-c7ABWZpggW9R
363
363
  chellow/templates/g/supply_notes.html,sha256=WR3YwGh_qqTklSJ7JqWX6BKBc9rk_jMff4RiWZiF2CM,936
364
364
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
365
365
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
366
- chellow-1715329858.0.0.dist-info/METADATA,sha256=BQZ9tHpLeOFjIHah8sWynsNdPnzLkwfnXQPYiBVjBN4,12205
367
- chellow-1715329858.0.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
368
- chellow-1715329858.0.0.dist-info/RECORD,,
366
+ chellow-1715873476.0.0.dist-info/METADATA,sha256=5qysvugFv1uEf-D4XOI0puLlQnhADi536FsnFnyivXU,12205
367
+ chellow-1715873476.0.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
368
+ chellow-1715873476.0.0.dist-info/RECORD,,