chellow 1726827015.0.0__py3-none-any.whl → 1727166948.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 +27 -23
- chellow/reports/report_233.py +24 -6
- chellow/templates/e/channel_snags.html +15 -3
- chellow/templates/e/dc_contracts.html +6 -0
- {chellow-1726827015.0.0.dist-info → chellow-1727166948.0.0.dist-info}/METADATA +1 -1
- {chellow-1726827015.0.0.dist-info → chellow-1727166948.0.0.dist-info}/RECORD +7 -7
- {chellow-1726827015.0.0.dist-info → chellow-1727166948.0.0.dist-info}/WHEEL +0 -0
chellow/e/views.py
CHANGED
|
@@ -340,38 +340,41 @@ def channel_edit_post(channel_id):
|
|
|
340
340
|
|
|
341
341
|
@e.route("/channel_snags")
|
|
342
342
|
def channel_snags_get():
|
|
343
|
-
contract_id =
|
|
344
|
-
|
|
343
|
+
contract_id = req_int_none("dc_contract_id")
|
|
344
|
+
if contract_id is None:
|
|
345
|
+
contract = None
|
|
346
|
+
else:
|
|
347
|
+
contract = Contract.get_dc_by_id(g.sess, contract_id)
|
|
345
348
|
days_hidden = req_int("days_hidden")
|
|
346
349
|
is_ignored = req_bool("is_ignored")
|
|
347
350
|
|
|
348
|
-
|
|
349
|
-
|
|
351
|
+
cutoff_date = utc_datetime_now() - relativedelta(days=days_hidden)
|
|
352
|
+
|
|
353
|
+
total_snags_q = (
|
|
354
|
+
select(func.count())
|
|
355
|
+
.select_from(Snag)
|
|
350
356
|
.join(Channel)
|
|
351
357
|
.join(Era)
|
|
352
|
-
.
|
|
353
|
-
Snag.is_ignored == false(),
|
|
354
|
-
Era.dc_contract == contract,
|
|
355
|
-
Snag.start_date < utc_datetime_now() - relativedelta(days=days_hidden),
|
|
356
|
-
)
|
|
357
|
-
.count()
|
|
358
|
+
.where(Snag.is_ignored == false(), Snag.start_date < cutoff_date)
|
|
358
359
|
)
|
|
359
|
-
|
|
360
|
-
|
|
360
|
+
snags_q = (
|
|
361
|
+
select(Snag)
|
|
361
362
|
.join(Channel)
|
|
362
363
|
.join(Era)
|
|
363
364
|
.join(Era.site_eras)
|
|
364
365
|
.join(SiteEra.site)
|
|
365
|
-
.
|
|
366
|
-
Snag.is_ignored == is_ignored,
|
|
367
|
-
Era.dc_contract == contract,
|
|
368
|
-
Snag.start_date < utc_datetime_now() - relativedelta(days=days_hidden),
|
|
369
|
-
)
|
|
366
|
+
.where(Snag.is_ignored == is_ignored, Snag.start_date < cutoff_date)
|
|
370
367
|
.order_by(Site.code, Era.id, Snag.start_date, Snag.finish_date, Snag.channel_id)
|
|
371
368
|
)
|
|
369
|
+
if contract is not None:
|
|
370
|
+
total_snags_q = total_snags_q.where(Era.dc_contract == contract)
|
|
371
|
+
snags_q = snags_q.where(Era.dc_contract == contract)
|
|
372
|
+
|
|
373
|
+
total_snags = g.sess.execute(total_snags_q)
|
|
374
|
+
|
|
372
375
|
snag_groups = []
|
|
373
376
|
prev_snag = None
|
|
374
|
-
for snag in islice(
|
|
377
|
+
for snag in islice(g.sess.scalars(snags_q), 200):
|
|
375
378
|
if (
|
|
376
379
|
prev_snag is None
|
|
377
380
|
or snag.channel.era != prev_snag.channel.era
|
|
@@ -382,10 +385,12 @@ def channel_snags_get():
|
|
|
382
385
|
era = snag.channel.era
|
|
383
386
|
snag_group = {
|
|
384
387
|
"snags": [],
|
|
385
|
-
"sites": g.sess.
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
388
|
+
"sites": g.sess.scalars(
|
|
389
|
+
select(Site)
|
|
390
|
+
.join(Site.site_eras)
|
|
391
|
+
.where(SiteEra.era == era)
|
|
392
|
+
.order_by(Site.code)
|
|
393
|
+
),
|
|
389
394
|
"era": era,
|
|
390
395
|
"description": snag.description,
|
|
391
396
|
"start_date": snag.start_date,
|
|
@@ -398,7 +403,6 @@ def channel_snags_get():
|
|
|
398
403
|
return render_template(
|
|
399
404
|
"channel_snags.html",
|
|
400
405
|
contract=contract,
|
|
401
|
-
snags=snags,
|
|
402
406
|
total_snags=total_snags,
|
|
403
407
|
snag_groups=snag_groups,
|
|
404
408
|
is_ignored=is_ignored,
|
chellow/reports/report_233.py
CHANGED
|
@@ -7,6 +7,7 @@ from dateutil.relativedelta import relativedelta
|
|
|
7
7
|
|
|
8
8
|
from flask import g
|
|
9
9
|
|
|
10
|
+
from sqlalchemy.orm import joinedload
|
|
10
11
|
from sqlalchemy.sql.expression import false, select, true
|
|
11
12
|
|
|
12
13
|
from chellow.dloads import open_file
|
|
@@ -21,7 +22,14 @@ from chellow.models import (
|
|
|
21
22
|
Supply,
|
|
22
23
|
User,
|
|
23
24
|
)
|
|
24
|
-
from chellow.utils import
|
|
25
|
+
from chellow.utils import (
|
|
26
|
+
csv_make_val,
|
|
27
|
+
hh_before,
|
|
28
|
+
req_bool,
|
|
29
|
+
req_int,
|
|
30
|
+
req_int_none,
|
|
31
|
+
utc_datetime_now,
|
|
32
|
+
)
|
|
25
33
|
from chellow.views import chellow_redirect
|
|
26
34
|
|
|
27
35
|
|
|
@@ -30,9 +38,17 @@ def content(contract_id, days_hidden, is_ignored, user_id):
|
|
|
30
38
|
try:
|
|
31
39
|
with Session() as sess:
|
|
32
40
|
user = User.get_by_id(sess, user_id)
|
|
33
|
-
|
|
41
|
+
if contract_id is None:
|
|
42
|
+
contract = None
|
|
43
|
+
namef = "all"
|
|
44
|
+
else:
|
|
45
|
+
contract = Contract.get_dc_by_id(sess, contract_id)
|
|
46
|
+
namef = "".join(x if x.isalnum() else "_" for x in contract.name)
|
|
47
|
+
|
|
48
|
+
f = open_file(f"channel_snags_{namef}.csv", user, mode="w", newline="")
|
|
34
49
|
writer = csv.writer(f, lineterminator="\n")
|
|
35
50
|
titles = (
|
|
51
|
+
"contract",
|
|
36
52
|
"Hidden Days",
|
|
37
53
|
"Chellow Id",
|
|
38
54
|
"Imp MPAN Core",
|
|
@@ -50,8 +66,6 @@ def content(contract_id, days_hidden, is_ignored, user_id):
|
|
|
50
66
|
)
|
|
51
67
|
writer.writerow(titles)
|
|
52
68
|
|
|
53
|
-
contract = Contract.get_dc_by_id(sess, contract_id)
|
|
54
|
-
|
|
55
69
|
now = utc_datetime_now()
|
|
56
70
|
cutoff_date = now - relativedelta(days=days_hidden)
|
|
57
71
|
q = (
|
|
@@ -63,7 +77,6 @@ def content(contract_id, days_hidden, is_ignored, user_id):
|
|
|
63
77
|
.join(Site, SiteEra.site_id == Site.id)
|
|
64
78
|
.where(
|
|
65
79
|
SiteEra.is_physical == true(),
|
|
66
|
-
Era.dc_contract == contract,
|
|
67
80
|
Snag.start_date < cutoff_date,
|
|
68
81
|
)
|
|
69
82
|
.order_by(
|
|
@@ -75,7 +88,11 @@ def content(contract_id, days_hidden, is_ignored, user_id):
|
|
|
75
88
|
Snag.start_date,
|
|
76
89
|
Snag.id,
|
|
77
90
|
)
|
|
91
|
+
.options(joinedload(Era.dc_contract))
|
|
78
92
|
)
|
|
93
|
+
if contract is not None:
|
|
94
|
+
q = q.where(Era.dc_contract == contract)
|
|
95
|
+
|
|
79
96
|
if not is_ignored:
|
|
80
97
|
q = q.where(Snag.is_ignored == false())
|
|
81
98
|
|
|
@@ -97,6 +114,7 @@ def content(contract_id, days_hidden, is_ignored, user_id):
|
|
|
97
114
|
age_of_snag = delta.days
|
|
98
115
|
|
|
99
116
|
vals = {
|
|
117
|
+
"contract": era.dc_contract.name,
|
|
100
118
|
"Hidden Days": days_hidden,
|
|
101
119
|
"Chellow Id": snag.id,
|
|
102
120
|
"Imp MPAN Core": imp_mc,
|
|
@@ -124,7 +142,7 @@ def content(contract_id, days_hidden, is_ignored, user_id):
|
|
|
124
142
|
|
|
125
143
|
|
|
126
144
|
def do_get(sess):
|
|
127
|
-
contract_id =
|
|
145
|
+
contract_id = req_int_none("dc_contract_id")
|
|
128
146
|
days_hidden = req_int("days_hidden")
|
|
129
147
|
is_ignored = req_bool("is_ignored")
|
|
130
148
|
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{% extends "base.html" %}
|
|
2
2
|
|
|
3
3
|
{% block title %}
|
|
4
|
-
» DC Contracts »
|
|
4
|
+
» DC Contracts »
|
|
5
|
+
{% if contract %}
|
|
6
|
+
{{contract.name}} »
|
|
7
|
+
{% endif %}
|
|
8
|
+
Channel Snags
|
|
5
9
|
{% endblock %}
|
|
6
10
|
|
|
7
11
|
{% block nav %}
|
|
8
12
|
<a href="/e/dc_contracts">DC Contracts</a> »
|
|
9
|
-
|
|
13
|
+
{% if contract %}
|
|
14
|
+
<a href="/e/dc_contracts/{{contract.id}}">{{contract.name}}</a> »
|
|
15
|
+
{% endif %}
|
|
10
16
|
Channel Snags
|
|
11
17
|
{% endblock %}
|
|
12
18
|
|
|
@@ -31,7 +37,11 @@
|
|
|
31
37
|
<form action="/e/channel_snags">
|
|
32
38
|
<fieldset>
|
|
33
39
|
<legend>Show Channel Snags</legend>
|
|
34
|
-
<input type="hidden" name="dc_contract_id" value="
|
|
40
|
+
<input type="hidden" name="dc_contract_id" value="
|
|
41
|
+
{%- if contract -%}
|
|
42
|
+
{{contract.id}}
|
|
43
|
+
{%- endif -%}
|
|
44
|
+
">
|
|
35
45
|
<label>Hide snags < days old</label>
|
|
36
46
|
{{input_text('days_hidden', '0', 3, 3)}}
|
|
37
47
|
<label>Include ignored snags</label> {{input_checkbox('is_ignored', False)}}
|
|
@@ -51,6 +61,7 @@
|
|
|
51
61
|
<thead>
|
|
52
62
|
<tr>
|
|
53
63
|
<th>View</th>
|
|
64
|
+
<th>Contract</th>
|
|
54
65
|
<th>Import MPAN Core</th>
|
|
55
66
|
<th>Export MPAN Core</th>
|
|
56
67
|
<th>Sites</th>
|
|
@@ -73,6 +84,7 @@
|
|
|
73
84
|
{% endfor %}
|
|
74
85
|
</ul>
|
|
75
86
|
</td>
|
|
87
|
+
<td>{{snag_group.era.dc_contract}}</td>
|
|
76
88
|
<td>
|
|
77
89
|
{% if snag_group.era.imp_mpan_core %}
|
|
78
90
|
{{snag_group.era.imp_mpan_core}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: chellow
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1727166948.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)
|
|
@@ -39,7 +39,7 @@ chellow/e/system_price.py,sha256=6w5J7bzwFAZubE2zdOFRiS8IIrVP8hkoIOaG2yCt-Ic,623
|
|
|
39
39
|
chellow/e/tlms.py,sha256=M33D6YpMixu2KkwSCzDRM3kThLgShg8exp63Obo75l8,8905
|
|
40
40
|
chellow/e/tnuos.py,sha256=XseYztPUsQXNKuBmystO2kzzwAG9ehCZgpGBTdgSk-A,4313
|
|
41
41
|
chellow/e/triad.py,sha256=lIQj7EdUrcFwEqleuHZXYU_bfzIwNOqUVVxB3NPQt4A,13710
|
|
42
|
-
chellow/e/views.py,sha256=
|
|
42
|
+
chellow/e/views.py,sha256=AL7h9vqFUoCKjHmm769CScuaW2APy61poK2SIS0yN-c,220804
|
|
43
43
|
chellow/e/bill_parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
44
|
chellow/e/bill_parsers/activity_mop_stark_xlsx.py,sha256=UgWXDPzQkQghyj_lfgBqoSJpHB-t-qOdSaB8qY6GLog,4071
|
|
45
45
|
chellow/e/bill_parsers/annual_mop_stark_xlsx.py,sha256=-HMoIfa_utXYKA44RuC0Xqv3vd2HLeQU_4P0iBUd3WA,4219
|
|
@@ -77,7 +77,7 @@ chellow/reports/report_183.py,sha256=DZX-hHJPl_Tbgkt31C_cuLZg_5L2b6iCPQ5foOZizR0
|
|
|
77
77
|
chellow/reports/report_187.py,sha256=UvpaYHjyJFNV5puYq8_KxfzoBtVrwFgIGUOmC5oGA9A,9956
|
|
78
78
|
chellow/reports/report_219.py,sha256=cA0lfJKnJg41Zc4_gZB1KUXZ9JeJo0TiTlu5jm1bdDM,7158
|
|
79
79
|
chellow/reports/report_231.py,sha256=uhO1algP7sibpZVaniqGs56HOCPCQeDO-Y-UfvFQwnI,5311
|
|
80
|
-
chellow/reports/report_233.py,sha256=
|
|
80
|
+
chellow/reports/report_233.py,sha256=HJRn4wH7RsYIduD2MNZYjFTbgb5LIu8_-jmUuRc0Q6Y,5016
|
|
81
81
|
chellow/reports/report_241.py,sha256=AlFmSHnfG2HWv_ICmWX7fNpPwLHjq7mo1QtOTjSKO3k,5384
|
|
82
82
|
chellow/reports/report_247.py,sha256=0Tvce9acMR5nWB0ITJh9n2V5qlEVtSWFEle-ca0P2Bw,44368
|
|
83
83
|
chellow/reports/report_29.py,sha256=KDFjgrLBv4WbG9efCdu_geMR7gT_QV9N97Wfdt7aDc4,2736
|
|
@@ -161,7 +161,7 @@ chellow/templates/e/channel_add.html,sha256=szwQJBHx2kAoSFomXDHD0N_7PSd4drqOoAWh
|
|
|
161
161
|
chellow/templates/e/channel_edit.html,sha256=OUkdiS2NBQ_w4gmxRxXAcRToM5BT8DWWJrtQMFs-GUU,2198
|
|
162
162
|
chellow/templates/e/channel_snag.html,sha256=wBJ5KBfeJdAeRmaB0qu0AD9Z4nM5fn6tJ_8bNqTWtoo,1477
|
|
163
163
|
chellow/templates/e/channel_snag_edit.html,sha256=sUFI4Ml3F1B35x8_t_Pz3hWuQN9Xtxr3kt4u8hdxNwY,1911
|
|
164
|
-
chellow/templates/e/channel_snags.html,sha256=
|
|
164
|
+
chellow/templates/e/channel_snags.html,sha256=KZZnCzaif-v8Inkc-FwhYtl1_SzwbKUqZQTKUeqnZkU,3152
|
|
165
165
|
chellow/templates/e/comm.html,sha256=DSlAaDg1r4KYq9VUgDtt2lgW6apZjZvwhMujIJINmps,383
|
|
166
166
|
chellow/templates/e/comms.html,sha256=bUXZePnMfpKk1E71qLGOSkx8r3GxdPPD_-MosIXXq4s,434
|
|
167
167
|
chellow/templates/e/cop.html,sha256=ULv7ALFJHMUgPX96hQNm2irc3edtKYHS6fYAxvmzj8M,376
|
|
@@ -192,7 +192,7 @@ chellow/templates/e/dc_contract_hh_import.html,sha256=JncR3L6cOK4jghsGyr-itEqlIe
|
|
|
192
192
|
chellow/templates/e/dc_contract_hh_imports.html,sha256=eXFDGyzSgag4JRism81_p5yTzQOjCIXaVkQ8tl3dDcM,8172
|
|
193
193
|
chellow/templates/e/dc_contract_properties.html,sha256=2EmA91gYWZcTOHQ3PxXQrpTOb8dm0OGjwRWsW6qNI9s,455
|
|
194
194
|
chellow/templates/e/dc_contract_properties_edit.html,sha256=TGYcHTlWbk5WmjZPkdbHhRVZcOpEfhowCp2penZcGiE,1704
|
|
195
|
-
chellow/templates/e/dc_contracts.html,sha256=
|
|
195
|
+
chellow/templates/e/dc_contracts.html,sha256=FPZUM7fkw-R6sRELHZCQTUkKSRqad8HOLHnyyYhQEEw,1819
|
|
196
196
|
chellow/templates/e/dc_contracts_add.html,sha256=2lrGrNqAoKp16OiMoNDNlJxBMW3QdSPfgEFheSg826s,710
|
|
197
197
|
chellow/templates/e/dc_rate_script.html,sha256=gfKUHV2IMsTQT-cYfjl4aiEBqGEWSj3uW22UZpoyGq4,1219
|
|
198
198
|
chellow/templates/e/dc_rate_script_add.html,sha256=5MlE4r5eLww3xI9qZRlu8hE8bU7RVwyDJcr20-0e4uY,644
|
|
@@ -366,6 +366,6 @@ chellow/templates/g/supply_note_edit.html,sha256=b8mB6_ucBwoljp03iy6AgVaZUhGw3-1
|
|
|
366
366
|
chellow/templates/g/supply_notes.html,sha256=6epNmZ3NKdXZz27fvmRUGeffg_oc1kmwuBeyRzQe3Rg,854
|
|
367
367
|
chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
|
|
368
368
|
chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
|
|
369
|
-
chellow-
|
|
370
|
-
chellow-
|
|
371
|
-
chellow-
|
|
369
|
+
chellow-1727166948.0.0.dist-info/METADATA,sha256=OFqmReMcR3x1oI4pDpOfuE-psdPEqI8sF4QQV5SPCsE,12204
|
|
370
|
+
chellow-1727166948.0.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
371
|
+
chellow-1727166948.0.0.dist-info/RECORD,,
|
|
File without changes
|