chellow 1715858374.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)
@@ -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: 1715858374.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
@@ -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-1715858374.0.0.dist-info/METADATA,sha256=RhFE3Rlbcn0s-EnZM2XRUvEZmrglXW_AhNDP81qq__c,12205
367
- chellow-1715858374.0.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
368
- chellow-1715858374.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,,