chellow 1733390302.0.0__py3-none-any.whl → 1733501869.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/__init__.py +0 -1
- chellow/e/bill_parsers/mm.py +27 -5
- chellow/e/computer.py +1 -7
- chellow/e/views.py +4 -10
- chellow/gas/engine.py +1 -3
- chellow/gas/views.py +3 -2
- chellow/reports/report_109.py +2 -3
- chellow/reports/report_111.py +2 -3
- chellow/reports/report_169.py +2 -3
- chellow/reports/report_181.py +2 -3
- chellow/reports/report_183.py +3 -4
- chellow/reports/report_187.py +2 -3
- chellow/reports/report_219.py +2 -3
- chellow/reports/report_231.py +2 -3
- chellow/reports/report_233.py +2 -3
- chellow/reports/report_241.py +2 -3
- chellow/reports/report_247.py +2 -3
- chellow/reports/report_29.py +2 -3
- chellow/reports/report_291.py +2 -3
- chellow/reports/report_33.py +2 -3
- chellow/reports/report_387.py +2 -3
- chellow/reports/report_41.py +2 -3
- chellow/reports/report_429.py +2 -3
- chellow/reports/report_59.py +2 -3
- chellow/reports/report_81.py +2 -3
- chellow/reports/report_87.py +3 -7
- chellow/reports/report_asset_comparison.py +2 -3
- chellow/reports/report_batches.py +2 -3
- chellow/reports/report_bills.py +4 -3
- chellow/reports/report_csv_llfcs.py +2 -3
- chellow/reports/report_csv_site_hh_data.py +2 -3
- chellow/reports/report_csv_site_snags.py +2 -3
- chellow/reports/report_ecoes_comparison.py +2 -3
- chellow/reports/report_g_monthly_duration.py +2 -3
- chellow/reports/report_g_supplies_snapshot.py +2 -3
- chellow/reports/report_g_supply_virtual_bill.py +2 -3
- chellow/reports/report_g_virtual_bills.py +2 -3
- chellow/reports/report_g_virtual_bills_hh.py +2 -3
- chellow/reports/report_sscs.py +2 -3
- chellow/reports/report_supply_contacts.py +2 -3
- chellow/templates/e/dc_contract_properties_edit.html +10 -10
- chellow/utils.py +0 -2
- chellow/views.py +33 -48
- {chellow-1733390302.0.0.dist-info → chellow-1733501869.0.0.dist-info}/METADATA +1 -1
- {chellow-1733390302.0.0.dist-info → chellow-1733501869.0.0.dist-info}/RECORD +46 -46
- {chellow-1733390302.0.0.dist-info → chellow-1733501869.0.0.dist-info}/WHEEL +0 -0
chellow/__init__.py
CHANGED
|
@@ -89,7 +89,6 @@ def create_app(testing=False, instance_path=None):
|
|
|
89
89
|
props = configuration.make_properties()
|
|
90
90
|
api_props = props.get("api", {})
|
|
91
91
|
api.description = api_props.get("description", "Access Chellow data")
|
|
92
|
-
chellow.utils.url_root = props.get("url_root", "")
|
|
93
92
|
|
|
94
93
|
chellow.dloads.startup(Path(app.instance_path), run_deleter=(not testing))
|
|
95
94
|
|
chellow/e/bill_parsers/mm.py
CHANGED
|
@@ -36,7 +36,16 @@ def _handle_0000(headers, pre_record, record):
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
def _handle_0050(headers, pre_record, record):
|
|
39
|
-
|
|
39
|
+
parts = _chop_record(
|
|
40
|
+
record,
|
|
41
|
+
issue_date=DATE_LENGTH,
|
|
42
|
+
unknown_1=12,
|
|
43
|
+
unknown_2=12,
|
|
44
|
+
unknown_3=12,
|
|
45
|
+
unknown_4=12,
|
|
46
|
+
late_payment=12,
|
|
47
|
+
)
|
|
48
|
+
headers["late_payment"] = Decimal(parts["late_payment"]) / Decimal(100)
|
|
40
49
|
|
|
41
50
|
|
|
42
51
|
def _handle_0051(headers, pre_record, record):
|
|
@@ -45,8 +54,11 @@ def _handle_0051(headers, pre_record, record):
|
|
|
45
54
|
|
|
46
55
|
def _handle_0100(headers, pre_record, record):
|
|
47
56
|
issue_date = headers["issue_date"]
|
|
57
|
+
late_payment = headers.get("late_payment")
|
|
48
58
|
headers.clear()
|
|
49
59
|
headers["issue_date"] = issue_date
|
|
60
|
+
if late_payment is not None:
|
|
61
|
+
headers["late_payment"] = late_payment
|
|
50
62
|
headers["account"] = pre_record[33:41]
|
|
51
63
|
headers["reference"] = pre_record[41:46]
|
|
52
64
|
headers["kwh"] = Decimal("0")
|
|
@@ -263,6 +275,16 @@ def _handle_1500(headers, pre_record, record):
|
|
|
263
275
|
net=12,
|
|
264
276
|
vat=12,
|
|
265
277
|
)
|
|
278
|
+
breakdown = headers["breakdown"]
|
|
279
|
+
net = Decimal("0.00") + Decimal(parts["net"]) / Decimal("100")
|
|
280
|
+
gross = Decimal("0.00") + Decimal(parts["gross"]) / Decimal("100")
|
|
281
|
+
if "late_payment" in headers:
|
|
282
|
+
late_payment_gbp = headers["late_payment"]
|
|
283
|
+
net += late_payment_gbp
|
|
284
|
+
gross += late_payment_gbp
|
|
285
|
+
breakdown["late-payment-gbp"] += late_payment_gbp
|
|
286
|
+
del headers["late_payment"]
|
|
287
|
+
|
|
266
288
|
return {
|
|
267
289
|
"bill_type_code": "N",
|
|
268
290
|
"mpan_core": headers["mpan_core"],
|
|
@@ -272,10 +294,10 @@ def _handle_1500(headers, pre_record, record):
|
|
|
272
294
|
"start_date": headers["start_date"],
|
|
273
295
|
"finish_date": headers["finish_date"],
|
|
274
296
|
"kwh": headers["kwh"],
|
|
275
|
-
"net":
|
|
297
|
+
"net": net,
|
|
276
298
|
"vat": Decimal("0.00") + Decimal(parts["vat"]) / Decimal("100"),
|
|
277
|
-
"gross":
|
|
278
|
-
"breakdown":
|
|
299
|
+
"gross": gross,
|
|
300
|
+
"breakdown": breakdown,
|
|
279
301
|
"reads": headers["reads"],
|
|
280
302
|
}
|
|
281
303
|
|
|
@@ -291,7 +313,7 @@ def _handle_1600(headers, pre_record, record):
|
|
|
291
313
|
)
|
|
292
314
|
late_payment_gbp = Decimal(parts["late_payment_fee"]) / Decimal(100)
|
|
293
315
|
|
|
294
|
-
headers["breakdown"]["
|
|
316
|
+
headers["breakdown"]["late-payment-gbp"] += late_payment_gbp
|
|
295
317
|
|
|
296
318
|
|
|
297
319
|
def _handle_1700(headers, pre_record, record):
|
chellow/e/computer.py
CHANGED
|
@@ -16,8 +16,6 @@ from werkzeug.exceptions import BadRequest
|
|
|
16
16
|
|
|
17
17
|
from zish import dumps
|
|
18
18
|
|
|
19
|
-
import chellow.bank_holidays
|
|
20
|
-
import chellow.utils
|
|
21
19
|
from chellow.models import (
|
|
22
20
|
Bill,
|
|
23
21
|
BillType,
|
|
@@ -218,11 +216,7 @@ def hh_rate(sess, caches, contract_id_or_name, date, market_role_code=None):
|
|
|
218
216
|
f"The market role code {market_role_code} isn't recognized."
|
|
219
217
|
)
|
|
220
218
|
|
|
221
|
-
vals = PropDict(
|
|
222
|
-
f"the rate script {chellow.utils.url_root}{seg}{rs.id} ",
|
|
223
|
-
loads(rs.script),
|
|
224
|
-
[],
|
|
225
|
-
)
|
|
219
|
+
vals = PropDict(f"the rate script {seg}{rs.id} ", loads(rs.script), [])
|
|
226
220
|
for dt in hh_range(caches, cstart, cfinish):
|
|
227
221
|
if dt not in cont_cache:
|
|
228
222
|
cont_cache[dt] = vals
|
chellow/e/views.py
CHANGED
|
@@ -16,6 +16,7 @@ from flask import (
|
|
|
16
16
|
flash,
|
|
17
17
|
g,
|
|
18
18
|
make_response,
|
|
19
|
+
redirect,
|
|
19
20
|
render_template as rtemplate,
|
|
20
21
|
request,
|
|
21
22
|
)
|
|
@@ -105,14 +106,13 @@ from chellow.utils import (
|
|
|
105
106
|
utc_datetime_now,
|
|
106
107
|
)
|
|
107
108
|
from chellow.views import (
|
|
108
|
-
chellow_redirect as credirect,
|
|
109
109
|
hx_redirect as chx_redirect,
|
|
110
110
|
requires_editor,
|
|
111
111
|
)
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
def chellow_redirect(path, code=None):
|
|
115
|
-
return
|
|
115
|
+
return redirect(f"/e{path}", code)
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
def hx_redirect(path, code=None):
|
|
@@ -1421,9 +1421,7 @@ def dno_rate_script_edit_delete(dno_rate_script_id):
|
|
|
1421
1421
|
dno = Party.get_dno_by_code(g.sess, contract.name, rate_script.start_date)
|
|
1422
1422
|
contract.delete_rate_script(g.sess, rate_script)
|
|
1423
1423
|
g.sess.commit()
|
|
1424
|
-
|
|
1425
|
-
res.headers["HX-Redirect"] = f"{chellow.utils.url_root}/e/dnos/{dno.id}"
|
|
1426
|
-
return res
|
|
1424
|
+
return hx_redirect(f"/dnos/{dno.id}")
|
|
1427
1425
|
except BadRequest as e:
|
|
1428
1426
|
flash(e.description)
|
|
1429
1427
|
return render_template(
|
|
@@ -6020,11 +6018,7 @@ def supply_note_edit_delete(supply_id, index):
|
|
|
6020
6018
|
del supply_note["notes"][index]
|
|
6021
6019
|
supply.note = dumps(supply_note)
|
|
6022
6020
|
g.sess.commit()
|
|
6023
|
-
|
|
6024
|
-
res.headers["HX-Redirect"] = (
|
|
6025
|
-
f"{chellow.utils.url_root}/e/supplies/{supply_id}/notes"
|
|
6026
|
-
)
|
|
6027
|
-
return res
|
|
6021
|
+
return hx_redirect(f"/supplies/{supply_id}/notes")
|
|
6028
6022
|
except BadRequest as e:
|
|
6029
6023
|
flash(e.description)
|
|
6030
6024
|
supply_note = loads(supply.note)
|
chellow/gas/engine.py
CHANGED
|
@@ -13,7 +13,6 @@ from werkzeug.exceptions import BadRequest
|
|
|
13
13
|
|
|
14
14
|
from zish import dumps, loads
|
|
15
15
|
|
|
16
|
-
import chellow.bank_holidays
|
|
17
16
|
from chellow.e.computer import hh_rate
|
|
18
17
|
from chellow.models import (
|
|
19
18
|
BillType,
|
|
@@ -323,8 +322,7 @@ def g_rates(sess, caches, g_contract_id_or_name, date, is_industry):
|
|
|
323
322
|
prefix = "industry" if g_contract.is_industry else "supplier"
|
|
324
323
|
|
|
325
324
|
vals = PropDict(
|
|
326
|
-
f"the rate script
|
|
327
|
-
f"{rs.id} ",
|
|
325
|
+
f"the rate script /g/{prefix}_rate_scripts/{rs.id} ",
|
|
328
326
|
loads(rs.script),
|
|
329
327
|
[],
|
|
330
328
|
)
|
chellow/gas/views.py
CHANGED
|
@@ -13,6 +13,7 @@ from flask import (
|
|
|
13
13
|
flash,
|
|
14
14
|
g,
|
|
15
15
|
make_response,
|
|
16
|
+
redirect,
|
|
16
17
|
render_template as rtemplate,
|
|
17
18
|
request,
|
|
18
19
|
)
|
|
@@ -60,11 +61,11 @@ from chellow.utils import (
|
|
|
60
61
|
utc_datetime,
|
|
61
62
|
utc_datetime_now,
|
|
62
63
|
)
|
|
63
|
-
from chellow.views import
|
|
64
|
+
from chellow.views import hx_redirect as chx_redirect
|
|
64
65
|
|
|
65
66
|
|
|
66
67
|
def chellow_redirect(path, code=None):
|
|
67
|
-
return
|
|
68
|
+
return redirect(f"/g{path}", code)
|
|
68
69
|
|
|
69
70
|
|
|
70
71
|
def hx_redirect(path, code=None):
|
chellow/reports/report_109.py
CHANGED
|
@@ -4,7 +4,7 @@ import threading
|
|
|
4
4
|
import traceback
|
|
5
5
|
from datetime import datetime as Datetime
|
|
6
6
|
|
|
7
|
-
from flask import g
|
|
7
|
+
from flask import g, redirect
|
|
8
8
|
|
|
9
9
|
from sqlalchemy import or_, text
|
|
10
10
|
from sqlalchemy.sql.expression import null
|
|
@@ -13,7 +13,6 @@ from chellow.dloads import open_file
|
|
|
13
13
|
from chellow.e.computer import SiteSource, contract_func, displaced_era, forecast_date
|
|
14
14
|
from chellow.models import Contract, Era, Session, Site, SiteEra, Source, Supply
|
|
15
15
|
from chellow.utils import c_months_u, hh_format, hh_range, req_int
|
|
16
|
-
from chellow.views import chellow_redirect
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
def to_val(v):
|
|
@@ -274,4 +273,4 @@ def do_get(sess):
|
|
|
274
273
|
contract_id = req_int("supplier_contract_id")
|
|
275
274
|
args = contract_id, end_year, end_month, months, g.user
|
|
276
275
|
threading.Thread(target=content, args=args).start()
|
|
277
|
-
return
|
|
276
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_111.py
CHANGED
|
@@ -9,7 +9,7 @@ from itertools import combinations
|
|
|
9
9
|
|
|
10
10
|
from dateutil.relativedelta import relativedelta
|
|
11
11
|
|
|
12
|
-
from flask import g, request
|
|
12
|
+
from flask import g, redirect, request
|
|
13
13
|
|
|
14
14
|
from sqlalchemy import or_, select
|
|
15
15
|
from sqlalchemy.orm import joinedload, subqueryload
|
|
@@ -49,7 +49,6 @@ from chellow.utils import (
|
|
|
49
49
|
req_str,
|
|
50
50
|
to_utc,
|
|
51
51
|
)
|
|
52
|
-
from chellow.views import chellow_redirect
|
|
53
52
|
|
|
54
53
|
|
|
55
54
|
def add_gap(caches, gaps, elem, start_date, finish_date, is_virtual, gbp):
|
|
@@ -298,7 +297,7 @@ def do_post(sess):
|
|
|
298
297
|
report_run.id,
|
|
299
298
|
)
|
|
300
299
|
threading.Thread(target=content, args=args).start()
|
|
301
|
-
return
|
|
300
|
+
return redirect(f"/report_runs/{report_run.id}", 303)
|
|
302
301
|
|
|
303
302
|
|
|
304
303
|
def _process_supply(
|
chellow/reports/report_169.py
CHANGED
|
@@ -3,7 +3,7 @@ import threading
|
|
|
3
3
|
import traceback
|
|
4
4
|
from io import StringIO
|
|
5
5
|
|
|
6
|
-
from flask import g, request
|
|
6
|
+
from flask import g, redirect, request
|
|
7
7
|
|
|
8
8
|
from sqlalchemy import or_, select
|
|
9
9
|
from sqlalchemy.sql.expression import null
|
|
@@ -23,7 +23,6 @@ from chellow.utils import (
|
|
|
23
23
|
to_ct,
|
|
24
24
|
to_utc,
|
|
25
25
|
)
|
|
26
|
-
from chellow.views import chellow_redirect
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
def _write_row(writer, titles, vals, total):
|
|
@@ -266,4 +265,4 @@ def handle_request(mpan_cores=None):
|
|
|
266
265
|
user.id,
|
|
267
266
|
)
|
|
268
267
|
threading.Thread(target=content, args=args).start()
|
|
269
|
-
return
|
|
268
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_181.py
CHANGED
|
@@ -2,7 +2,7 @@ import csv
|
|
|
2
2
|
import threading
|
|
3
3
|
import traceback
|
|
4
4
|
|
|
5
|
-
from flask import g, request
|
|
5
|
+
from flask import g, redirect, request
|
|
6
6
|
|
|
7
7
|
from sqlalchemy import or_
|
|
8
8
|
from sqlalchemy.sql.expression import null
|
|
@@ -23,7 +23,6 @@ from chellow.utils import (
|
|
|
23
23
|
req_int,
|
|
24
24
|
to_utc,
|
|
25
25
|
)
|
|
26
|
-
from chellow.views import chellow_redirect
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
def _make_sites(sess, year_start, year_finish, site_id, source_codes):
|
|
@@ -169,4 +168,4 @@ def do_get(sess):
|
|
|
169
168
|
site_id = req_int("site_id") if "site_id" in request.values else None
|
|
170
169
|
year = req_int("year")
|
|
171
170
|
threading.Thread(target=content, args=(year, site_id, g.user.id)).start()
|
|
172
|
-
return
|
|
171
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_183.py
CHANGED
|
@@ -4,7 +4,7 @@ import threading
|
|
|
4
4
|
import traceback
|
|
5
5
|
from io import StringIO
|
|
6
6
|
|
|
7
|
-
from flask import g, request
|
|
7
|
+
from flask import g, redirect, request
|
|
8
8
|
|
|
9
9
|
from sqlalchemy import or_, select
|
|
10
10
|
from sqlalchemy.orm import joinedload
|
|
@@ -22,7 +22,6 @@ from chellow.utils import (
|
|
|
22
22
|
to_ct,
|
|
23
23
|
to_utc,
|
|
24
24
|
)
|
|
25
|
-
from chellow.views import chellow_redirect
|
|
26
25
|
|
|
27
26
|
|
|
28
27
|
def _write_row(writer, titles, vals, total):
|
|
@@ -241,7 +240,7 @@ def do_post(sess):
|
|
|
241
240
|
file_name = f"sites_hh_data_{site_id}_{finish_date_str}.csv"
|
|
242
241
|
args = site_id, start_date, finish_date, g.user.id, file_name
|
|
243
242
|
threading.Thread(target=site_content, args=args).start()
|
|
244
|
-
return
|
|
243
|
+
return redirect("/downloads", 303)
|
|
245
244
|
else:
|
|
246
245
|
typ = req_str("type")
|
|
247
246
|
site_codes_str = req_str("site_codes")
|
|
@@ -252,4 +251,4 @@ def do_post(sess):
|
|
|
252
251
|
file_name = f"sites_hh_data_{finish_date_str}_filter.zip"
|
|
253
252
|
args = site_codes, typ, start_date, finish_date, g.user.id, file_name
|
|
254
253
|
threading.Thread(target=none_content, args=args).start()
|
|
255
|
-
return
|
|
254
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_187.py
CHANGED
|
@@ -2,7 +2,7 @@ import threading
|
|
|
2
2
|
import traceback
|
|
3
3
|
from datetime import datetime as Datetime
|
|
4
4
|
|
|
5
|
-
from flask import g, request
|
|
5
|
+
from flask import g, redirect, request
|
|
6
6
|
|
|
7
7
|
from sqlalchemy import null, or_, select, text, true
|
|
8
8
|
|
|
@@ -20,7 +20,6 @@ from chellow.utils import (
|
|
|
20
20
|
req_str,
|
|
21
21
|
to_ct,
|
|
22
22
|
)
|
|
23
|
-
from chellow.views import chellow_redirect
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
def csv_str(row):
|
|
@@ -267,4 +266,4 @@ def do_post(sess):
|
|
|
267
266
|
args = start_date, finish_date, supply_id, mpan_cores, is_zipped, g.user.id
|
|
268
267
|
|
|
269
268
|
threading.Thread(target=content, args=args).start()
|
|
270
|
-
return
|
|
269
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_219.py
CHANGED
|
@@ -2,7 +2,7 @@ import csv
|
|
|
2
2
|
import threading
|
|
3
3
|
import traceback
|
|
4
4
|
|
|
5
|
-
from flask import g, request
|
|
5
|
+
from flask import g, redirect, request
|
|
6
6
|
|
|
7
7
|
from sqlalchemy import and_, or_, select
|
|
8
8
|
from sqlalchemy.orm import joinedload
|
|
@@ -21,7 +21,6 @@ from chellow.models import (
|
|
|
21
21
|
User,
|
|
22
22
|
)
|
|
23
23
|
from chellow.utils import c_months_u, csv_make_val, req_int
|
|
24
|
-
from chellow.views import chellow_redirect
|
|
25
24
|
|
|
26
25
|
|
|
27
26
|
def content(year, month, months, supply_id, user_id):
|
|
@@ -189,4 +188,4 @@ def do_get(sess):
|
|
|
189
188
|
supply_id = req_int("supply_id") if "supply_id" in request.values else None
|
|
190
189
|
args = year, month, months, supply_id, g.user.id
|
|
191
190
|
threading.Thread(target=content, args=args).start()
|
|
192
|
-
return
|
|
191
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_231.py
CHANGED
|
@@ -3,7 +3,7 @@ import sys
|
|
|
3
3
|
import threading
|
|
4
4
|
import traceback
|
|
5
5
|
|
|
6
|
-
from flask import g
|
|
6
|
+
from flask import g, redirect
|
|
7
7
|
|
|
8
8
|
from sqlalchemy import or_
|
|
9
9
|
from sqlalchemy.sql.expression import null
|
|
@@ -14,7 +14,6 @@ from chellow.dloads import open_file
|
|
|
14
14
|
from chellow.e.computer import SupplySource, contract_func, forecast_date
|
|
15
15
|
from chellow.models import Contract, Era, Session, User
|
|
16
16
|
from chellow.utils import csv_make_val, hh_format, hh_max, hh_min, req_date, req_int
|
|
17
|
-
from chellow.views import chellow_redirect
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
def content(user_id, start_date, finish_date, contract_id):
|
|
@@ -134,4 +133,4 @@ def do_get(sess):
|
|
|
134
133
|
|
|
135
134
|
args = g.user.id, start_date, finish_date, contract_id
|
|
136
135
|
threading.Thread(target=content, args=args).start()
|
|
137
|
-
return
|
|
136
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_233.py
CHANGED
|
@@ -5,7 +5,7 @@ import traceback
|
|
|
5
5
|
|
|
6
6
|
from dateutil.relativedelta import relativedelta
|
|
7
7
|
|
|
8
|
-
from flask import g
|
|
8
|
+
from flask import g, redirect
|
|
9
9
|
|
|
10
10
|
from sqlalchemy.orm import joinedload
|
|
11
11
|
from sqlalchemy.sql.expression import false, select, true
|
|
@@ -30,7 +30,6 @@ from chellow.utils import (
|
|
|
30
30
|
req_int_none,
|
|
31
31
|
utc_datetime_now,
|
|
32
32
|
)
|
|
33
|
-
from chellow.views import chellow_redirect
|
|
34
33
|
|
|
35
34
|
|
|
36
35
|
def content(contract_id, days_hidden, is_ignored, user_id):
|
|
@@ -148,4 +147,4 @@ def do_get(sess):
|
|
|
148
147
|
|
|
149
148
|
args = contract_id, days_hidden, is_ignored, g.user.id
|
|
150
149
|
threading.Thread(target=content, args=args).start()
|
|
151
|
-
return
|
|
150
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_241.py
CHANGED
|
@@ -5,7 +5,7 @@ from datetime import datetime as Datetime
|
|
|
5
5
|
|
|
6
6
|
from dateutil.relativedelta import relativedelta
|
|
7
7
|
|
|
8
|
-
from flask import g
|
|
8
|
+
from flask import g, redirect
|
|
9
9
|
|
|
10
10
|
import pytz
|
|
11
11
|
|
|
@@ -17,7 +17,6 @@ from chellow.dloads import open_file
|
|
|
17
17
|
from chellow.e.computer import SupplySource, contract_func, forecast_date
|
|
18
18
|
from chellow.models import Era, Session, Site, SiteEra, Supply, User
|
|
19
19
|
from chellow.utils import HH, csv_make_val, hh_format, hh_max, hh_min, req_bool, req_int
|
|
20
|
-
from chellow.views import chellow_redirect
|
|
21
20
|
|
|
22
21
|
|
|
23
22
|
def content(
|
|
@@ -164,4 +163,4 @@ def do_get(sess):
|
|
|
164
163
|
g.user.id,
|
|
165
164
|
)
|
|
166
165
|
threading.Thread(target=content, args=args).start()
|
|
167
|
-
return
|
|
166
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_247.py
CHANGED
|
@@ -6,7 +6,7 @@ from datetime import datetime as Datetime
|
|
|
6
6
|
|
|
7
7
|
from dateutil.relativedelta import relativedelta
|
|
8
8
|
|
|
9
|
-
from flask import flash, g, make_response, render_template, request
|
|
9
|
+
from flask import flash, g, make_response, redirect, render_template, request
|
|
10
10
|
|
|
11
11
|
import odio
|
|
12
12
|
|
|
@@ -48,7 +48,6 @@ from chellow.utils import (
|
|
|
48
48
|
to_utc,
|
|
49
49
|
utc_datetime_now,
|
|
50
50
|
)
|
|
51
|
-
from chellow.views import chellow_redirect
|
|
52
51
|
|
|
53
52
|
|
|
54
53
|
CATEGORY_ORDER = {None: 0, "unmetered": 1, "nhh": 2, "amr": 3, "hh": 4}
|
|
@@ -1129,7 +1128,7 @@ def do_post(sess):
|
|
|
1129
1128
|
|
|
1130
1129
|
args = (scenario_props, base_name, user.id, compression, now)
|
|
1131
1130
|
threading.Thread(target=content, args=args).start()
|
|
1132
|
-
return
|
|
1131
|
+
return redirect("/downloads", 303)
|
|
1133
1132
|
except BadRequest as e:
|
|
1134
1133
|
flash(e.description)
|
|
1135
1134
|
if "scenario_id" in request.values:
|
chellow/reports/report_29.py
CHANGED
|
@@ -3,12 +3,11 @@ import sys
|
|
|
3
3
|
import threading
|
|
4
4
|
import traceback
|
|
5
5
|
|
|
6
|
-
from flask import g
|
|
6
|
+
from flask import g, redirect
|
|
7
7
|
|
|
8
8
|
from chellow.dloads import open_file
|
|
9
9
|
from chellow.models import Session, Site, User
|
|
10
10
|
from chellow.utils import c_months_u, csv_make_val, req_int, req_str, to_ct
|
|
11
|
-
from chellow.views import chellow_redirect
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
def _write_row(writer, total, values, titles):
|
|
@@ -78,4 +77,4 @@ def do_get(sess):
|
|
|
78
77
|
site_id = req_int("site_id")
|
|
79
78
|
args = start_date, finish_date, site_id, typ, g.user.id
|
|
80
79
|
threading.Thread(target=content, args=args).start()
|
|
81
|
-
return
|
|
80
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_291.py
CHANGED
|
@@ -2,7 +2,7 @@ import csv
|
|
|
2
2
|
import threading
|
|
3
3
|
import traceback
|
|
4
4
|
|
|
5
|
-
from flask import g
|
|
5
|
+
from flask import g, redirect
|
|
6
6
|
|
|
7
7
|
from sqlalchemy import or_
|
|
8
8
|
from sqlalchemy.sql.expression import null, true
|
|
@@ -23,7 +23,6 @@ from chellow.models import (
|
|
|
23
23
|
User,
|
|
24
24
|
)
|
|
25
25
|
from chellow.utils import csv_make_val, hh_format, hh_max, hh_min, req_date, req_int
|
|
26
|
-
from chellow.views import chellow_redirect
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
def content(supply_id, start_date, finish_date, user_id):
|
|
@@ -209,4 +208,4 @@ def do_get(sess):
|
|
|
209
208
|
args = supply_id, start_date, finish_date, g.user.id
|
|
210
209
|
|
|
211
210
|
threading.Thread(target=content, args=args).start()
|
|
212
|
-
return
|
|
211
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_33.py
CHANGED
|
@@ -5,7 +5,7 @@ import traceback
|
|
|
5
5
|
|
|
6
6
|
from dateutil.relativedelta import relativedelta
|
|
7
7
|
|
|
8
|
-
from flask import g, request
|
|
8
|
+
from flask import g, redirect, request
|
|
9
9
|
|
|
10
10
|
from sqlalchemy import or_, text
|
|
11
11
|
from sqlalchemy.orm import joinedload
|
|
@@ -42,7 +42,6 @@ from chellow.utils import (
|
|
|
42
42
|
req_int,
|
|
43
43
|
req_str,
|
|
44
44
|
)
|
|
45
|
-
from chellow.views import chellow_redirect
|
|
46
45
|
|
|
47
46
|
|
|
48
47
|
def content(user_id, date, supply_id, mpan_cores):
|
|
@@ -528,4 +527,4 @@ def do_get(session):
|
|
|
528
527
|
|
|
529
528
|
args = user.id, date, supply_id, mpan_cores
|
|
530
529
|
threading.Thread(target=content, args=args).start()
|
|
531
|
-
return
|
|
530
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_387.py
CHANGED
|
@@ -3,7 +3,7 @@ import sys
|
|
|
3
3
|
import threading
|
|
4
4
|
import traceback
|
|
5
5
|
|
|
6
|
-
from flask import g
|
|
6
|
+
from flask import g, redirect
|
|
7
7
|
|
|
8
8
|
from sqlalchemy import or_, select
|
|
9
9
|
from sqlalchemy.sql.expression import null, true
|
|
@@ -18,7 +18,6 @@ from chellow.utils import (
|
|
|
18
18
|
req_date,
|
|
19
19
|
req_int,
|
|
20
20
|
)
|
|
21
|
-
from chellow.views import chellow_redirect
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
def content(supply_id, start_date, finish_date, user):
|
|
@@ -162,4 +161,4 @@ def do_get(sess):
|
|
|
162
161
|
|
|
163
162
|
args = supply_id, start_date, finish_date, g.user
|
|
164
163
|
threading.Thread(target=content, args=args).start()
|
|
165
|
-
return
|
|
164
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_41.py
CHANGED
|
@@ -4,7 +4,7 @@ import threading
|
|
|
4
4
|
import traceback
|
|
5
5
|
from datetime import datetime as Datetime
|
|
6
6
|
|
|
7
|
-
from flask import g, request
|
|
7
|
+
from flask import g, redirect, request
|
|
8
8
|
|
|
9
9
|
from sqlalchemy import or_
|
|
10
10
|
from sqlalchemy.sql.expression import null, true
|
|
@@ -23,7 +23,6 @@ from chellow.utils import (
|
|
|
23
23
|
req_int,
|
|
24
24
|
to_utc,
|
|
25
25
|
)
|
|
26
|
-
from chellow.views import chellow_redirect
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
def _make_eras(sess, nov_start, year_finish, supply_id):
|
|
@@ -211,4 +210,4 @@ def do_get(sess):
|
|
|
211
210
|
year = req_int("year")
|
|
212
211
|
supply_id = req_int("supply_id") if "supply_id" in request.values else None
|
|
213
212
|
threading.Thread(target=content, args=(year, supply_id, g.user.id)).start()
|
|
214
|
-
return
|
|
213
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_429.py
CHANGED
|
@@ -7,7 +7,7 @@ from datetime import datetime as Datetime
|
|
|
7
7
|
from decimal import Decimal
|
|
8
8
|
from itertools import combinations
|
|
9
9
|
|
|
10
|
-
from flask import g, request
|
|
10
|
+
from flask import g, redirect, request
|
|
11
11
|
|
|
12
12
|
from sqlalchemy import null, or_, select, true
|
|
13
13
|
from sqlalchemy.orm import joinedload
|
|
@@ -18,7 +18,6 @@ import chellow.gas.engine
|
|
|
18
18
|
from chellow.dloads import open_file
|
|
19
19
|
from chellow.models import GBatch, GBill, GContract, GEra, Session, Site, SiteGEra, User
|
|
20
20
|
from chellow.utils import csv_make_val, hh_max, hh_min, req_date, req_int, to_utc
|
|
21
|
-
from chellow.views import chellow_redirect
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
def content(g_batch_id, g_bill_id, g_contract_id, start_date, finish_date, user_id):
|
|
@@ -361,4 +360,4 @@ def do_get(sess):
|
|
|
361
360
|
|
|
362
361
|
args = g_batch_id, g_bill_id, g_contract_id, start_date, finish_date, g.user.id
|
|
363
362
|
threading.Thread(target=content, args=args).start()
|
|
364
|
-
return
|
|
363
|
+
return redirect("/downloads", 303)
|
chellow/reports/report_59.py
CHANGED
|
@@ -5,7 +5,7 @@ from collections import defaultdict
|
|
|
5
5
|
|
|
6
6
|
from dateutil.relativedelta import relativedelta
|
|
7
7
|
|
|
8
|
-
from flask import flash, g, make_response, render_template, request
|
|
8
|
+
from flask import flash, g, make_response, redirect, render_template, request
|
|
9
9
|
|
|
10
10
|
import odio
|
|
11
11
|
|
|
@@ -50,7 +50,6 @@ from chellow.utils import (
|
|
|
50
50
|
to_utc,
|
|
51
51
|
utc_datetime_now,
|
|
52
52
|
)
|
|
53
|
-
from chellow.views import chellow_redirect
|
|
54
53
|
|
|
55
54
|
|
|
56
55
|
CATEGORY_ORDER = {None: 0, "unmetered": 1, "nhh": 2, "amr": 3, "hh": 4}
|
|
@@ -1072,7 +1071,7 @@ def do_post(sess):
|
|
|
1072
1071
|
sess.rollback()
|
|
1073
1072
|
thread = threading.Thread(target=content, args=args)
|
|
1074
1073
|
thread.start()
|
|
1075
|
-
return
|
|
1074
|
+
return redirect("/downloads", 303)
|
|
1076
1075
|
except BadRequest as e:
|
|
1077
1076
|
flash(e.description)
|
|
1078
1077
|
if "scenario_id" in request.values:
|
chellow/reports/report_81.py
CHANGED
|
@@ -2,7 +2,7 @@ import csv
|
|
|
2
2
|
import threading
|
|
3
3
|
import traceback
|
|
4
4
|
|
|
5
|
-
from flask import g
|
|
5
|
+
from flask import g, redirect
|
|
6
6
|
|
|
7
7
|
from sqlalchemy import or_
|
|
8
8
|
from sqlalchemy.orm import joinedload
|
|
@@ -14,7 +14,6 @@ from chellow.dloads import open_file
|
|
|
14
14
|
from chellow.e.computer import SupplySource, contract_func, forecast_date
|
|
15
15
|
from chellow.models import Contract, Era, RSession, User
|
|
16
16
|
from chellow.utils import c_months_u, csv_make_val, hh_format, hh_max, hh_min, req_int
|
|
17
|
-
from chellow.views import chellow_redirect
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
def content(user_id, contract_id, end_year, end_month, months):
|
|
@@ -147,4 +146,4 @@ def do_get(sess):
|
|
|
147
146
|
|
|
148
147
|
args = g.user.id, contract_id, end_year, end_month, months
|
|
149
148
|
threading.Thread(target=content, args=args).start()
|
|
150
|
-
return
|
|
149
|
+
return redirect("/downloads", 303)
|