chellow 1725528079.0.0__py3-none-any.whl → 1725628177.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 +130 -41
- chellow/templates/e/supply_edit.html +72 -87
- {chellow-1725528079.0.0.dist-info → chellow-1725628177.0.0.dist-info}/METADATA +1 -1
- {chellow-1725528079.0.0.dist-info → chellow-1725628177.0.0.dist-info}/RECORD +5 -5
- {chellow-1725528079.0.0.dist-info → chellow-1725628177.0.0.dist-info}/WHEEL +0 -0
chellow/e/views.py
CHANGED
|
@@ -5898,11 +5898,23 @@ def supply_months_get(supply_id):
|
|
|
5898
5898
|
@e.route("/supplies/<int:supply_id>/edit")
|
|
5899
5899
|
def supply_edit_get(supply_id):
|
|
5900
5900
|
supply = Supply.get_by_id(g.sess, supply_id)
|
|
5901
|
-
sources = g.sess.
|
|
5902
|
-
generator_types = g.sess.
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5901
|
+
sources = g.sess.scalars(select(Source).order_by(Source.code))
|
|
5902
|
+
generator_types = g.sess.scalars(select(GeneratorType).order_by(GeneratorType.code))
|
|
5903
|
+
|
|
5904
|
+
dno_contract = Contract.get_dno_by_name(g.sess, supply.dno.dno_code)
|
|
5905
|
+
dno_rate_script = dno_contract.find_rate_script_at(
|
|
5906
|
+
g.sess, supply.eras[-1].start_date
|
|
5907
|
+
)
|
|
5908
|
+
dno_props = dno_rate_script.make_script()
|
|
5909
|
+
allowed_gsp_group_codes = list(dno_props.keys())
|
|
5910
|
+
|
|
5911
|
+
gsp_groups = g.sess.scalars(
|
|
5912
|
+
select(GspGroup)
|
|
5913
|
+
.where(GspGroup.code.in_(allowed_gsp_group_codes))
|
|
5914
|
+
.order_by(GspGroup.code)
|
|
5915
|
+
)
|
|
5916
|
+
eras = g.sess.scalars(
|
|
5917
|
+
select(Era).where(Era.supply == supply).order_by(Era.start_date.desc())
|
|
5906
5918
|
)
|
|
5907
5919
|
return render_template(
|
|
5908
5920
|
"supply_edit.html",
|
|
@@ -5914,50 +5926,127 @@ def supply_edit_get(supply_id):
|
|
|
5914
5926
|
)
|
|
5915
5927
|
|
|
5916
5928
|
|
|
5917
|
-
@e.route("/supplies/<int:supply_id>/edit", methods=["
|
|
5918
|
-
def
|
|
5929
|
+
@e.route("/supplies/<int:supply_id>/edit", methods=["DELETE"])
|
|
5930
|
+
def supply_edit_delete(supply_id):
|
|
5919
5931
|
try:
|
|
5920
5932
|
supply = Supply.get_by_id(g.sess, supply_id)
|
|
5921
5933
|
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
break
|
|
5934
|
+
site_id = None
|
|
5935
|
+
for site_era in supply.eras[-1].site_eras:
|
|
5936
|
+
if site_era.is_physical:
|
|
5937
|
+
site_id = site_era.site.id
|
|
5938
|
+
break
|
|
5928
5939
|
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5940
|
+
supply.delete(g.sess)
|
|
5941
|
+
g.sess.commit()
|
|
5942
|
+
return hx_redirect(f"/sites/{site_id}", 303)
|
|
5943
|
+
except BadRequest as e:
|
|
5944
|
+
g.sess.rollback()
|
|
5945
|
+
flash(e.description)
|
|
5946
|
+
sources = g.sess.scalars(select(Source).order_by(Source.code))
|
|
5947
|
+
generator_types = g.sess.scalars(
|
|
5948
|
+
select(GeneratorType).order_by(GeneratorType.code)
|
|
5949
|
+
)
|
|
5950
|
+
dno_contract = Contract.get_dno_by_name(g.sess, supply.dno.dno_code)
|
|
5951
|
+
dno_rate_script = dno_contract.find_rate_script_at(
|
|
5952
|
+
g.sess, supply.eras[-1].start_date
|
|
5953
|
+
)
|
|
5954
|
+
dno_props = dno_rate_script.make_script()
|
|
5955
|
+
allowed_gsp_group_codes = list(dno_props.keys())
|
|
5956
|
+
|
|
5957
|
+
gsp_groups = g.sess.scalars(
|
|
5958
|
+
select(GspGroup)
|
|
5959
|
+
.where(GspGroup.code.in_(allowed_gsp_group_codes))
|
|
5960
|
+
.order_by(GspGroup.code)
|
|
5961
|
+
)
|
|
5962
|
+
eras = g.sess.scalars(
|
|
5963
|
+
select(Era).where(Era.supply == supply).order_by(Era.start_date.desc())
|
|
5964
|
+
)
|
|
5965
|
+
return make_response(
|
|
5966
|
+
render_template(
|
|
5967
|
+
"supply_edit.html",
|
|
5968
|
+
supply=supply,
|
|
5969
|
+
sources=sources,
|
|
5970
|
+
generator_types=generator_types,
|
|
5971
|
+
gsp_groups=gsp_groups,
|
|
5972
|
+
eras=eras,
|
|
5973
|
+
),
|
|
5974
|
+
400,
|
|
5975
|
+
)
|
|
5976
|
+
|
|
5977
|
+
|
|
5978
|
+
@e.route("/supplies/<int:supply_id>/edit", methods=["PATCH"])
|
|
5979
|
+
def supply_edit_patch(supply_id):
|
|
5980
|
+
try:
|
|
5981
|
+
supply = Supply.get_by_id(g.sess, supply_id)
|
|
5982
|
+
|
|
5983
|
+
name = req_str("name")
|
|
5984
|
+
source_id = req_int("source_id")
|
|
5985
|
+
gsp_group_id = req_int("gsp_group_id")
|
|
5986
|
+
source = Source.get_by_id(g.sess, source_id)
|
|
5987
|
+
if source.code in ("gen", "gen-grid"):
|
|
5988
|
+
generator_type_id = req_int("generator_type_id")
|
|
5989
|
+
generator_type = GeneratorType.get_by_id(g.sess, generator_type_id)
|
|
5937
5990
|
else:
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
generator_type_id = req_int("generator_type_id")
|
|
5944
|
-
generator_type = GeneratorType.get_by_id(g.sess, generator_type_id)
|
|
5945
|
-
else:
|
|
5946
|
-
generator_type = None
|
|
5947
|
-
gsp_group = GspGroup.get_by_id(g.sess, gsp_group_id)
|
|
5948
|
-
supply.update(name, source, generator_type, gsp_group, supply.dno)
|
|
5949
|
-
g.sess.commit()
|
|
5950
|
-
return chellow_redirect(f"/supplies/{supply.id}", 303)
|
|
5991
|
+
generator_type = None
|
|
5992
|
+
gsp_group = GspGroup.get_by_id(g.sess, gsp_group_id)
|
|
5993
|
+
supply.update(name, source, generator_type, gsp_group, supply.dno)
|
|
5994
|
+
g.sess.commit()
|
|
5995
|
+
return hx_redirect(f"/supplies/{supply.id}", 303)
|
|
5951
5996
|
except BadRequest as e:
|
|
5952
5997
|
g.sess.rollback()
|
|
5953
5998
|
flash(e.description)
|
|
5954
|
-
sources = g.sess.
|
|
5955
|
-
generator_types = g.sess.
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
.
|
|
5999
|
+
sources = g.sess.scalars(select(Source).order_by(Source.code))
|
|
6000
|
+
generator_types = g.sess.scalars(
|
|
6001
|
+
select(GeneratorType).order_by(GeneratorType.code)
|
|
6002
|
+
)
|
|
6003
|
+
dno_contract = Contract.get_dno_by_name(g.sess, supply.dno.dno_code)
|
|
6004
|
+
dno_rate_script = dno_contract.find_rate_script_at(
|
|
6005
|
+
g.sess, supply.eras[-1].start_date
|
|
6006
|
+
)
|
|
6007
|
+
dno_props = dno_rate_script.make_script()
|
|
6008
|
+
allowed_gsp_group_codes = list(dno_props.keys())
|
|
6009
|
+
|
|
6010
|
+
gsp_groups = g.sess.scalars(
|
|
6011
|
+
select(GspGroup)
|
|
6012
|
+
.where(GspGroup.code.in_(allowed_gsp_group_codes))
|
|
6013
|
+
.order_by(GspGroup.code)
|
|
6014
|
+
)
|
|
6015
|
+
eras = g.sess.scalars(
|
|
6016
|
+
select(Era).where(Era.supply == supply).order_by(Era.start_date.desc())
|
|
6017
|
+
)
|
|
6018
|
+
return make_response(
|
|
6019
|
+
render_template(
|
|
6020
|
+
"supply_edit.html",
|
|
6021
|
+
supply=supply,
|
|
6022
|
+
sources=sources,
|
|
6023
|
+
generator_types=generator_types,
|
|
6024
|
+
gsp_groups=gsp_groups,
|
|
6025
|
+
eras=eras,
|
|
6026
|
+
),
|
|
6027
|
+
400,
|
|
6028
|
+
)
|
|
6029
|
+
|
|
6030
|
+
|
|
6031
|
+
@e.route("/supplies/<int:supply_id>/edit", methods=["POST"])
|
|
6032
|
+
def supply_edit_post(supply_id):
|
|
6033
|
+
try:
|
|
6034
|
+
supply = Supply.get_by_id(g.sess, supply_id)
|
|
6035
|
+
|
|
6036
|
+
start_date = req_date("start")
|
|
6037
|
+
supply.insert_era_at(g.sess, start_date)
|
|
6038
|
+
g.sess.commit()
|
|
6039
|
+
return chellow_redirect(f"/supplies/{supply.id}", 303)
|
|
6040
|
+
except BadRequest as e:
|
|
6041
|
+
g.sess.rollback()
|
|
6042
|
+
flash(e.description)
|
|
6043
|
+
sources = g.sess.scalars(select(Source).order_by(Source.code))
|
|
6044
|
+
generator_types = g.sess.scalars(
|
|
6045
|
+
select(GeneratorType).order_by(GeneratorType.code)
|
|
6046
|
+
)
|
|
6047
|
+
gsp_groups = g.sess.scalars(select(GspGroup).order_by(GspGroup.code))
|
|
6048
|
+
eras = g.sess.scalars(
|
|
6049
|
+
select(Era).where(Era.supply == supply).order_by(Era.start_date.desc())
|
|
5961
6050
|
)
|
|
5962
6051
|
return make_response(
|
|
5963
6052
|
render_template(
|
|
@@ -11,95 +11,80 @@
|
|
|
11
11
|
|
|
12
12
|
{% block content %}
|
|
13
13
|
|
|
14
|
-
{
|
|
14
|
+
<form hx-patch="/e/supplies/{{supply.id}}/edit">
|
|
15
|
+
<fieldset>
|
|
16
|
+
<legend>Update this supply</legend>
|
|
17
|
+
<label>Name</label> {{input_text('name', supply.name)}}
|
|
18
|
+
<label>Source</label>
|
|
19
|
+
<select name="source_id">
|
|
20
|
+
{% for source in sources %}
|
|
21
|
+
{{input_option('source_id', source.id, source.code, supply.source.id)}}
|
|
22
|
+
{% endfor %}
|
|
23
|
+
</select>
|
|
24
|
+
<label>Generator Type (if source is 'gen' or 'gen-net')</label>
|
|
25
|
+
<select name="generator_type_id">
|
|
26
|
+
{% for generator_type in generator_types %}
|
|
27
|
+
{{input_option(
|
|
28
|
+
'generator_type_id', generator_type.id, generator_type.code,
|
|
29
|
+
supply.generator_type.id)}}
|
|
30
|
+
{% endfor %}
|
|
31
|
+
</select>
|
|
32
|
+
<label>GSP Group</label>
|
|
33
|
+
<select name="gsp_group_id">
|
|
34
|
+
{% for gsp_group in gsp_groups %}
|
|
35
|
+
{{input_option(
|
|
36
|
+
'gsp_group_id', gsp_group.id,
|
|
37
|
+
gsp_group.code + ' ' + gsp_group.description, supply.gsp_group.id)}}
|
|
38
|
+
{% endfor %}
|
|
39
|
+
</select>
|
|
40
|
+
<input type="submit" value="Update">
|
|
41
|
+
</fieldset>
|
|
42
|
+
</form>
|
|
15
43
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
44
|
+
<form hx-delete="/e/supplies/{{supply.id}}/edit"
|
|
45
|
+
hx-confirm="Are you sure you want to delete this supply?">
|
|
46
|
+
<fieldset>
|
|
47
|
+
<legend>Delete this supply</legend>
|
|
48
|
+
<input type="submit" name="delete" value="Delete">
|
|
49
|
+
</fieldset>
|
|
50
|
+
</form>
|
|
23
51
|
|
|
24
|
-
|
|
52
|
+
<form method="post" action="/e/supplies/{{supply.id}}/edit">
|
|
53
|
+
<fieldset>
|
|
54
|
+
<legend>Insert a new era</legend>
|
|
55
|
+
<label>Start date</label> {{input_date('start', None)}}
|
|
56
|
+
<input type="submit" name="insert_era" value="Insert">
|
|
57
|
+
</fieldset>
|
|
58
|
+
</form>
|
|
25
59
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{%
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
</fieldset>
|
|
56
|
-
</form>
|
|
57
|
-
|
|
58
|
-
<form action="/e/supplies/{{supply.id}}/edit">
|
|
59
|
-
<fieldset>
|
|
60
|
-
<legend>Delete this supply</legend>
|
|
61
|
-
<input type="submit" name="delete" value="Delete">
|
|
62
|
-
</fieldset>
|
|
63
|
-
</form>
|
|
64
|
-
|
|
65
|
-
<form method="post" action="/e/supplies/{{supply.id}}/edit">
|
|
66
|
-
<fieldset>
|
|
67
|
-
<legend>Insert a new era</legend>
|
|
68
|
-
<label>Start date</label> {{input_date('start', None)}}
|
|
69
|
-
<input type="submit" name="insert_era" value="Insert">
|
|
70
|
-
</fieldset>
|
|
71
|
-
</form>
|
|
72
|
-
|
|
73
|
-
<table>
|
|
74
|
-
<caption>Existing Eras</caption>
|
|
75
|
-
<thead>
|
|
76
|
-
<tr>
|
|
77
|
-
<th>Start date</th>
|
|
78
|
-
<th>Finish date</th>
|
|
79
|
-
<th>Import Mpan Core</th>
|
|
80
|
-
<th>Export Mpan Core</th>
|
|
81
|
-
</tr>
|
|
82
|
-
</thead>
|
|
83
|
-
<tbody>
|
|
84
|
-
{% for era in eras %}
|
|
85
|
-
<tr>
|
|
86
|
-
<td>{{era.start_date|hh_format}}</td>
|
|
87
|
-
<td>{{era.finish_date|hh_format}}</td>
|
|
88
|
-
<td>
|
|
89
|
-
{% if era.imp_mpan_core %}
|
|
90
|
-
{{era.imp_mpan_core}}
|
|
91
|
-
{% endif %}
|
|
92
|
-
</td>
|
|
93
|
-
<td>
|
|
94
|
-
{% if era.exp_mpan_core %}
|
|
95
|
-
{{era.exp_mpan_core}}
|
|
96
|
-
{% endif %}
|
|
97
|
-
</td>
|
|
98
|
-
</tr>
|
|
99
|
-
{% endfor %}
|
|
100
|
-
</tbody>
|
|
101
|
-
</table>
|
|
102
|
-
|
|
103
|
-
{% endif %}
|
|
60
|
+
<table>
|
|
61
|
+
<caption>Existing Eras</caption>
|
|
62
|
+
<thead>
|
|
63
|
+
<tr>
|
|
64
|
+
<th>Start date</th>
|
|
65
|
+
<th>Finish date</th>
|
|
66
|
+
<th>Import Mpan Core</th>
|
|
67
|
+
<th>Export Mpan Core</th>
|
|
68
|
+
</tr>
|
|
69
|
+
</thead>
|
|
70
|
+
<tbody>
|
|
71
|
+
{% for era in eras %}
|
|
72
|
+
<tr>
|
|
73
|
+
<td>{{era.start_date|hh_format}}</td>
|
|
74
|
+
<td>{{era.finish_date|hh_format}}</td>
|
|
75
|
+
<td>
|
|
76
|
+
{% if era.imp_mpan_core %}
|
|
77
|
+
{{era.imp_mpan_core}}
|
|
78
|
+
{% endif %}
|
|
79
|
+
</td>
|
|
80
|
+
<td>
|
|
81
|
+
{% if era.exp_mpan_core %}
|
|
82
|
+
{{era.exp_mpan_core}}
|
|
83
|
+
{% endif %}
|
|
84
|
+
</td>
|
|
85
|
+
</tr>
|
|
86
|
+
{% endfor %}
|
|
87
|
+
</tbody>
|
|
88
|
+
</table>
|
|
104
89
|
|
|
105
90
|
{% endblock %}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: chellow
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1725628177.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)
|
|
@@ -38,7 +38,7 @@ chellow/e/system_price.py,sha256=6w5J7bzwFAZubE2zdOFRiS8IIrVP8hkoIOaG2yCt-Ic,623
|
|
|
38
38
|
chellow/e/tlms.py,sha256=M33D6YpMixu2KkwSCzDRM3kThLgShg8exp63Obo75l8,8905
|
|
39
39
|
chellow/e/tnuos.py,sha256=XseYztPUsQXNKuBmystO2kzzwAG9ehCZgpGBTdgSk-A,4313
|
|
40
40
|
chellow/e/triad.py,sha256=lIQj7EdUrcFwEqleuHZXYU_bfzIwNOqUVVxB3NPQt4A,13710
|
|
41
|
-
chellow/e/views.py,sha256=
|
|
41
|
+
chellow/e/views.py,sha256=NwDgs0iZ6nmfX4qF5sSwFlecSsqDBMRsf46vxuIkgVg,219605
|
|
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
|
|
@@ -310,7 +310,7 @@ chellow/templates/e/supplier_rate_script.html,sha256=tjWeCUAgNip3VLHzbXqe19Msias
|
|
|
310
310
|
chellow/templates/e/supplier_rate_script_add.html,sha256=Yf2LZEIHbL7qT6oxBCtPf0ZX7vJsSo_ZeOKJhJoVh3o,690
|
|
311
311
|
chellow/templates/e/supplier_rate_script_edit.html,sha256=VaYJt8nxHdnuP-zEAuBJC-ibEpjDU1b80hXtdBQH1dg,1968
|
|
312
312
|
chellow/templates/e/supply.html,sha256=No26xivLm4hA8kRufVvPjrEOE3of7pmZaW_jgTcKSY0,8511
|
|
313
|
-
chellow/templates/e/supply_edit.html,sha256=
|
|
313
|
+
chellow/templates/e/supply_edit.html,sha256=2BRGU35nb0ZpUHKCi_fgAPMU6SlHI7ve3_Ne8LXHtms,2333
|
|
314
314
|
chellow/templates/e/supply_eras.html,sha256=5lB7_oC-sTWRQoASuPgBWj5XSZa9ajR0s6V6xKHvf6E,19996
|
|
315
315
|
chellow/templates/e/supply_hh_data.html,sha256=d9ho4Tq3ZkR5GmxSZr_zHGwCU68PH3aSc4OwFG9i9zE,3587
|
|
316
316
|
chellow/templates/e/supply_months.html,sha256=2EUF_SWCcjG9GiAw86gco8xR6LXaqCPXfQE5A33TqqI,1927
|
|
@@ -365,6 +365,6 @@ chellow/templates/g/supply_note_edit.html,sha256=b8mB6_ucBwoljp03iy6AgVaZUhGw3-1
|
|
|
365
365
|
chellow/templates/g/supply_notes.html,sha256=6epNmZ3NKdXZz27fvmRUGeffg_oc1kmwuBeyRzQe3Rg,854
|
|
366
366
|
chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
|
|
367
367
|
chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
|
|
368
|
-
chellow-
|
|
369
|
-
chellow-
|
|
370
|
-
chellow-
|
|
368
|
+
chellow-1725628177.0.0.dist-info/METADATA,sha256=wHjj_Ouyy8wLs6Dv3TYkeiDOzc0SCVRSPCsUOjCnSoM,12204
|
|
369
|
+
chellow-1725628177.0.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
370
|
+
chellow-1725628177.0.0.dist-info/RECORD,,
|
|
File without changes
|