chellow 1733390302.0.0__py3-none-any.whl → 1734005435.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.

Files changed (49) hide show
  1. chellow/__init__.py +0 -1
  2. chellow/e/bill_parsers/mm.py +27 -5
  3. chellow/e/computer.py +1 -7
  4. chellow/e/views.py +126 -10
  5. chellow/gas/engine.py +1 -3
  6. chellow/gas/views.py +3 -2
  7. chellow/reports/report_109.py +2 -3
  8. chellow/reports/report_111.py +2 -3
  9. chellow/reports/report_169.py +2 -3
  10. chellow/reports/report_181.py +2 -3
  11. chellow/reports/report_183.py +3 -4
  12. chellow/reports/report_187.py +2 -3
  13. chellow/reports/report_219.py +2 -3
  14. chellow/reports/report_231.py +2 -3
  15. chellow/reports/report_233.py +2 -3
  16. chellow/reports/report_241.py +2 -3
  17. chellow/reports/report_247.py +2 -3
  18. chellow/reports/report_29.py +2 -3
  19. chellow/reports/report_291.py +2 -3
  20. chellow/reports/report_33.py +2 -3
  21. chellow/reports/report_387.py +2 -3
  22. chellow/reports/report_41.py +2 -3
  23. chellow/reports/report_429.py +2 -3
  24. chellow/reports/report_59.py +2 -3
  25. chellow/reports/report_81.py +2 -3
  26. chellow/reports/report_87.py +3 -7
  27. chellow/reports/report_asset_comparison.py +2 -3
  28. chellow/reports/report_batches.py +2 -3
  29. chellow/reports/report_bills.py +4 -3
  30. chellow/reports/report_csv_llfcs.py +2 -3
  31. chellow/reports/report_csv_site_hh_data.py +2 -3
  32. chellow/reports/report_csv_site_snags.py +2 -3
  33. chellow/reports/report_ecoes_comparison.py +2 -3
  34. chellow/reports/report_g_monthly_duration.py +2 -3
  35. chellow/reports/report_g_supplies_snapshot.py +2 -3
  36. chellow/reports/report_g_supply_virtual_bill.py +2 -3
  37. chellow/reports/report_g_virtual_bills.py +2 -3
  38. chellow/reports/report_g_virtual_bills_hh.py +2 -3
  39. chellow/reports/report_sscs.py +2 -3
  40. chellow/reports/report_supply_contacts.py +2 -3
  41. chellow/templates/e/dc_contract_properties_edit.html +10 -10
  42. chellow/templates/e/site_hh_data.html +73 -49
  43. chellow/templates/site.html +1 -1
  44. chellow/utils.py +0 -2
  45. chellow/views.py +33 -167
  46. {chellow-1733390302.0.0.dist-info → chellow-1734005435.0.0.dist-info}/METADATA +1 -1
  47. {chellow-1733390302.0.0.dist-info → chellow-1734005435.0.0.dist-info}/RECORD +48 -49
  48. chellow/templates/site_hh_data.html +0 -75
  49. {chellow-1733390302.0.0.dist-info → chellow-1734005435.0.0.dist-info}/WHEEL +0 -0
@@ -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 chellow_redirect("/downloads", 303)
213
+ return redirect("/downloads", 303)
@@ -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 chellow_redirect("/downloads", 303)
363
+ return redirect("/downloads", 303)
@@ -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 chellow_redirect("/downloads", 303)
1074
+ return redirect("/downloads", 303)
1076
1075
  except BadRequest as e:
1077
1076
  flash(e.description)
1078
1077
  if "scenario_id" in request.values:
@@ -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 chellow_redirect("/downloads", 303)
149
+ return redirect("/downloads", 303)
@@ -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_, select
8
8
  from sqlalchemy.sql.expression import null, true
@@ -32,7 +32,6 @@ from chellow.utils import (
32
32
  req_int,
33
33
  to_ct,
34
34
  )
35
- from chellow.views import chellow_redirect
36
35
 
37
36
 
38
37
  def _process_era(
@@ -202,10 +201,7 @@ def create_csv(f, sess, start_date, finish_date, contract_id):
202
201
  )
203
202
  writer.writerow(csv_make_val(vals.get(t)) for t in titles)
204
203
  except BadRequest as e:
205
- raise BadRequest(
206
- f"Problem with {chellow.utils.url_root}eras/{era.id}/edit "
207
- f"{e.description}"
208
- )
204
+ raise BadRequest(f"Problem with /e/eras/{era.id}/edit {e.description}")
209
205
 
210
206
  sess.rollback() # Avoid long-running transaction
211
207
 
@@ -243,4 +239,4 @@ def do_get(sess):
243
239
  threading.Thread(
244
240
  target=content, args=(start_date, finish_date, contract_id, g.user.id)
245
241
  ).start()
246
- return chellow_redirect("/downloads", 303)
242
+ return redirect("/downloads", 303)
@@ -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 select
10
10
  from sqlalchemy.orm import joinedload
@@ -14,7 +14,6 @@ from werkzeug.exceptions import BadRequest
14
14
 
15
15
  from chellow.dloads import open_file
16
16
  from chellow.models import Contract, Era, ReportRun, Session, Site, SiteEra, User
17
- from chellow.views import chellow_redirect
18
17
 
19
18
  STATUSES_ACTIVE = ("IN USE / IN SERVICE", "STORED SPARE")
20
19
  STATUSES_INACTIVE = ("DEMOLISHED", "SOLD", "ABANDONED")
@@ -194,4 +193,4 @@ def do_post(sess):
194
193
  sess.commit()
195
194
  args = user.id, StringIO(file_item.read().decode("utf8")), report_run.id
196
195
  threading.Thread(target=content, args=args).start()
197
- return chellow_redirect(f"/report_runs/{report_run.id}", 303)
196
+ return redirect(f"/report_runs/{report_run.id}", 303)
@@ -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.sql import func, select
8
8
 
@@ -16,7 +16,6 @@ from chellow.models import (
16
16
  User,
17
17
  )
18
18
  from chellow.utils import csv_make_val
19
- from chellow.views import chellow_redirect
20
19
 
21
20
 
22
21
  def content(user_id):
@@ -142,4 +141,4 @@ def content(user_id):
142
141
 
143
142
  def do_get(sess):
144
143
  threading.Thread(target=content, args=(g.user.id,)).start()
145
- return chellow_redirect("/downloads", 303)
144
+ return redirect("/downloads", 303)
@@ -3,7 +3,7 @@ import threading
3
3
  import traceback
4
4
  from collections import defaultdict
5
5
 
6
- from flask import g
6
+ from flask import g, redirect
7
7
 
8
8
  from sqlalchemy import select
9
9
  from sqlalchemy.orm import joinedload
@@ -11,7 +11,6 @@ from sqlalchemy.orm import joinedload
11
11
  from chellow.dloads import open_file
12
12
  from chellow.models import Batch, Bill, Session, User
13
13
  from chellow.utils import csv_make_val, req_int
14
- from chellow.views import chellow_redirect
15
14
 
16
15
 
17
16
  def _content(sess, writer, batch_id):
@@ -36,6 +35,7 @@ def _content(sess, writer, batch_id):
36
35
  "vat_2_percent",
37
36
  "vat_2_net",
38
37
  "vat_2_vat",
38
+ "breakdown",
39
39
  ]
40
40
  writer.writerow(titles)
41
41
 
@@ -79,6 +79,7 @@ def _content(sess, writer, batch_id):
79
79
  "vat_2_percent": None,
80
80
  "vat_2_net": None,
81
81
  "vat_2_vat": None,
82
+ "breakdown": bill.breakdown,
82
83
  }
83
84
  for i, (percentage, vbd) in enumerate(sorted(vat_breakdown.items()), 1):
84
85
  vals[f"vat_{i}_percentage"] = percentage
@@ -111,4 +112,4 @@ def do_get(sess):
111
112
  batch_id = req_int("batch_id")
112
113
  args = g.user.id, batch_id
113
114
  threading.Thread(target=content, args=args).start()
114
- return chellow_redirect("/downloads", 303)
115
+ return redirect("/downloads", 303)
@@ -2,14 +2,13 @@ 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.orm import joinedload
8
8
 
9
9
  from chellow.dloads import open_file
10
10
  from chellow.models import Llfc, Session, User
11
11
  from chellow.utils import hh_format
12
- from chellow.views import chellow_redirect
13
12
 
14
13
 
15
14
  def content(user_id):
@@ -64,4 +63,4 @@ def content(user_id):
64
63
  def do_get(sess):
65
64
  args = (g.user.id,)
66
65
  threading.Thread(target=content, args=args).start()
67
- return chellow_redirect("/downloads", 303)
66
+ return redirect("/downloads", 303)
@@ -3,7 +3,7 @@ import sys
3
3
  import threading
4
4
  import traceback
5
5
 
6
- from flask import g, request
6
+ from flask import g, redirect, request
7
7
 
8
8
  from sqlalchemy import null, or_, select, true
9
9
  from sqlalchemy.orm import joinedload
@@ -11,7 +11,6 @@ from sqlalchemy.orm import joinedload
11
11
  from chellow.dloads import open_file
12
12
  from chellow.models import Era, Session, Site, SiteEra, Source, Supply, User
13
13
  from chellow.utils import req_date, req_int, write_row
14
- from chellow.views import chellow_redirect
15
14
 
16
15
 
17
16
  TYPE_ORDER = {"hh": 0, "amr": 1, "nhh": 2, "unmetered": 3}
@@ -122,4 +121,4 @@ def do_get(sess):
122
121
 
123
122
  args = start_date, finish_date, site_id, g.user.id
124
123
  threading.Thread(target=content, args=args).start()
125
- return chellow_redirect("/downloads", 303)
124
+ return redirect("/downloads", 303)
@@ -3,7 +3,7 @@ import threading
3
3
  import traceback
4
4
  from datetime import datetime as Datetime, timedelta as Timedelta
5
5
 
6
- from flask import g
6
+ from flask import g, redirect
7
7
 
8
8
  import pytz
9
9
 
@@ -13,7 +13,6 @@ from sqlalchemy.sql.expression import null
13
13
  from chellow.dloads import open_file
14
14
  from chellow.models import Session, Site, Snag, User
15
15
  from chellow.utils import hh_format
16
- from chellow.views import chellow_redirect
17
16
 
18
17
 
19
18
  def content(user_id):
@@ -81,4 +80,4 @@ def content(user_id):
81
80
  def do_get(sess):
82
81
  args = (g.user.id,)
83
82
  threading.Thread(target=content, args=args).start()
84
- return chellow_redirect("/downloads", 303)
83
+ return redirect("/downloads", 303)
@@ -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
  import requests
9
9
 
@@ -26,7 +26,6 @@ from chellow.models import (
26
26
  User,
27
27
  )
28
28
  from chellow.utils import csv_make_val, req_bool
29
- from chellow.views import chellow_redirect
30
29
 
31
30
 
32
31
  FNAME = "ecoes_comparison"
@@ -615,4 +614,4 @@ def do_get(sess):
615
614
  sess.commit()
616
615
  args = g.user.id, show_ignored, report_run.id
617
616
  threading.Thread(target=content, args=args).start()
618
- return chellow_redirect(f"/report_runs/{report_run.id}", 303)
617
+ return redirect(f"/report_runs/{report_run.id}", 303)
@@ -1,7 +1,7 @@
1
1
  import threading
2
2
  import traceback
3
3
 
4
- from flask import g, request
4
+ from flask import g, redirect, request
5
5
 
6
6
  import odio
7
7
 
@@ -42,7 +42,6 @@ from chellow.utils import (
42
42
  to_utc,
43
43
  utc_datetime_now,
44
44
  )
45
- from chellow.views import chellow_redirect
46
45
 
47
46
 
48
47
  def write_spreadsheet(fl, compressed, site_rows, era_rows):
@@ -535,4 +534,4 @@ def do_get(sess):
535
534
  args = scenario_props, g.user.id, compression, now, base_name
536
535
 
537
536
  threading.Thread(target=content, args=args).start()
538
- return chellow_redirect("/downloads", 303)
537
+ return redirect("/downloads", 303)
@@ -3,7 +3,7 @@ import sys
3
3
  import threading
4
4
  import traceback
5
5
 
6
- from flask import g, request
6
+ from flask import g, redirect, request
7
7
 
8
8
  from sqlalchemy import or_
9
9
  from sqlalchemy.orm import joinedload
@@ -16,7 +16,6 @@ from chellow.e.computer import contract_func
16
16
  from chellow.gas.engine import GDataSource, forecast_date
17
17
  from chellow.models import GEra, GSupply, Session
18
18
  from chellow.utils import csv_make_val, req_date, req_int
19
- from chellow.views import chellow_redirect
20
19
 
21
20
 
22
21
  def content(date, g_supply_id, user):
@@ -136,4 +135,4 @@ def do_get(session):
136
135
 
137
136
  args = (date, g_supply_id, user)
138
137
  threading.Thread(target=content, args=args).start()
139
- return chellow_redirect("/downloads", 303)
138
+ return redirect("/downloads", 303)
@@ -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
@@ -14,7 +14,6 @@ from chellow.e.computer import forecast_date
14
14
  from chellow.gas.engine import GDataSource, g_contract_func
15
15
  from chellow.models import GEra, GSupply, Session, Site, SiteGEra
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(g_supply_id, file_name, start_date, finish_date, user):
@@ -107,4 +106,4 @@ def do_get(sess):
107
106
  args = (g_supply_id, file_name, start_date, finish_date, g.user)
108
107
 
109
108
  threading.Thread(target=content, args=args).start()
110
- return chellow_redirect("/downloads", 303)
109
+ return redirect("/downloads", 303)
@@ -4,7 +4,7 @@ import threading
4
4
  import traceback
5
5
 
6
6
 
7
- from flask import g
7
+ from flask import g, redirect
8
8
 
9
9
  from sqlalchemy import or_
10
10
  from sqlalchemy.sql.expression import null, true
@@ -25,7 +25,6 @@ from chellow.utils import (
25
25
  req_int,
26
26
  to_ct,
27
27
  )
28
- from chellow.views import chellow_redirect
29
28
 
30
29
 
31
30
  def content(start_date, finish_date, g_contract_id, user_id):
@@ -137,4 +136,4 @@ def do_get(sess):
137
136
 
138
137
  args = start_date, finish_date, g_contract_id, g.user.id
139
138
  threading.Thread(target=content, args=args).start()
140
- return chellow_redirect("/downloads", 303)
139
+ return redirect("/downloads", 303)
@@ -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, true
@@ -14,7 +14,6 @@ from chellow.e.computer import contract_func
14
14
  from chellow.gas.engine import GDataSource
15
15
  from chellow.models import GEra, GSupply, Session, Site, SiteGEra
16
16
  from chellow.utils import csv_make_val, hh_format, hh_range, req_date, req_int
17
- from chellow.views import chellow_redirect
18
17
 
19
18
 
20
19
  def content(g_supply_id, start_date, finish_date, user):
@@ -105,4 +104,4 @@ def do_get(sess):
105
104
 
106
105
  args = g_supply_id, start_date, finish_date, g.user
107
106
  threading.Thread(target=content, args=args).start()
108
- return chellow_redirect("/downloads", 303)
107
+ return redirect("/downloads", 303)
@@ -3,7 +3,7 @@ import threading
3
3
  import traceback
4
4
 
5
5
 
6
- from flask import g, request
6
+ from flask import g, redirect, request
7
7
 
8
8
  import odio
9
9
 
@@ -15,7 +15,6 @@ from werkzeug.exceptions import BadRequest
15
15
  from chellow.dloads import open_file
16
16
  from chellow.models import MeasurementRequirement, Session, Ssc, Tpr, User
17
17
  from chellow.utils import req_bool
18
- from chellow.views import chellow_redirect
19
18
 
20
19
 
21
20
  def write_spreadsheet(
@@ -114,4 +113,4 @@ def do_get(sess):
114
113
 
115
114
  args = (user.id, compression)
116
115
  threading.Thread(target=content, args=args).start()
117
- return chellow_redirect("/downloads", 303)
116
+ return redirect("/downloads", 303)
@@ -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 select
9
9
  from sqlalchemy.orm import joinedload
@@ -21,7 +21,6 @@ from chellow.models import (
21
21
  Supply,
22
22
  User,
23
23
  )
24
- from chellow.views import chellow_redirect
25
24
 
26
25
 
27
26
  FNAME = "supply_contacts"
@@ -127,4 +126,4 @@ def do_get(sess):
127
126
  report_run = ReportRun.insert(sess, FNAME, g.user, FNAME, {})
128
127
  sess.commit()
129
128
  threading.Thread(target=content, args=(g.user.id, report_run.id)).start()
130
- return chellow_redirect(f"/report_runs/{report_run.id}", 303)
129
+ return redirect(f"/report_runs/{report_run.id}", 303)
@@ -39,17 +39,17 @@
39
39
  "private_key": "private_key", /* Remove if using password */
40
40
  "directories": ["downloads1", "downloads2"],
41
41
  "mpan_map": { /* Optional */
42
- "99 0993 2821 985": {
43
- "mpan": null, /* Ignore MPAN */
44
- "from": 2024-12-04T10:00:00Z,
42
+ "99 0993 2821 985": {
43
+ "mpan": null, /* Ignore MPAN */
44
+ "from": 2024-12-04T10:00:00Z,
45
45
  "to": 2025-01-12:00:00Z,
46
- },
47
- "99 0873 1942 952": {
48
- "mpan": "99 7821 8541 389",
49
- "from": 2024-11-16T22:00:00Z,
50
- "to": 2025-02-18:00:00Z,
51
- },
52
- },
46
+ },
47
+ "99 0873 1942 952": {
48
+ "mpan": "99 7821 8541 389",
49
+ "from": 2024-11-16T22:00:00Z,
50
+ "to": 2025-02-18:00:00Z,
51
+ },
52
+ },
53
53
  }
54
54
  </pre>
55
55
  </code>
@@ -1,52 +1,76 @@
1
- <form>
2
- <fieldset>
3
- <label>Site Code </label>
4
- {{input_text('site_code', site.code)}}
5
- <label>Month</label>
6
- {{input_date(None, None, 'month')}}
7
- <input type="submit" value="Show">
8
- </fieldset>
9
- </form>
10
- <table class="sticky">
11
- <caption>HH Data</caption>
12
- <thead>
13
- <tr>
14
- <th>HH Starting</th>
15
- <th>Imported kWh</th>
16
- <th>Used kWh</th>
17
- <th>Displaced kWh</th>
18
- <th>Generated kWh</th>
19
- <th>Exported kWh</th>
20
- <th>Parasitic kWh</th>
21
- {% for supply in supplies %}
22
- {% set pref = supply.name + ' '+ supply.source.code +
23
- (' ' + supply.generator_type.code if
24
- supply.generator_type != None else '') %}
25
- <th style="border-left-width: medium;">{{pref}} Imp kWh</th>
26
- <th>{{pref}} Imp Status</th>
27
- <th>{{pref}} Exp kWh</th>
28
- <th>{{pref}} Exp Status</th>
29
- {% endfor %}
30
- </tr>
31
- </thead>
32
- <tbody>
33
- {% for hh in hh_data %}
1
+ {% extends "base.html" %}
2
+
3
+ {% block title %}
4
+ Sites &raquo; {{site.code}} {{site.name}} &raquo; HH data
5
+ {% endblock %}
6
+
7
+ {% block inside_head %}
8
+ <style>
9
+ tbody > tr {
10
+ scroll-margin-top: 8em;
11
+ }
12
+
13
+ tbody > tr:target {
14
+ background-color: yellow;
15
+ }
16
+ </style>
17
+ {% endblock %}
18
+
19
+ {% block nav %}
20
+ <a href="/sites">Sites</a> &raquo;
21
+ <a href="/sites/{{site.id}}">{{site.code}} {{site.name}}</a> &raquo; HH data
22
+ {% endblock %}
23
+
24
+ {% block content %}
25
+ <form action="/e/sites/{{site.id}}/hh_data">
26
+ <fieldset>
27
+ <label>Month</label> {{input_date(prefix='start', initial=start_date, resolution='month')}}
28
+ <input type="submit" value="Show">
29
+ </fieldset>
30
+ </form>
31
+
32
+ <table class="sticky">
33
+ <caption>HH Data</caption>
34
+ <thead>
34
35
  <tr>
35
- <td style="white-space: nowrap">{{hh.start_date|hh_format}}</td>
36
- <td>{{hh.import_kwh}}</td>
37
- <td>{{hh.used_kwh}}</td>
38
- <td>{{hh.displaced_kwh}}</td>
39
- <td>{{hh.generated_kwh}}</td>
40
- <td>{{hh.export_kwh}}</td>
41
- <td>{{hh.parasitic_kwh}}</td>
42
- {% for datum in hh.supplies %}
43
- <td style="border-left-width: medium;"
44
- >{{datum.import_kwh}}</td>
45
- <td>{{datum.import_status}}</td>
46
- <td>{{datum.export_kwh}}</td>
47
- <td>{{datum.export_status}}</td>
36
+ <th>HH Starting</th>
37
+ <th>Imported kWh</th>
38
+ <th>Used kWh</th>
39
+ <th>Displaced kWh</th>
40
+ <th>Generated kWh</th>
41
+ <th>Exported kWh</th>
42
+ <th>Parasitic kWh</th>
43
+ {% for supply in supplies %}
44
+ {% set pref = supply.name + ' '+ supply.source.code +
45
+ (' ' + supply.generator_type.code if
46
+ supply.generator_type != None else '') %}
47
+ <th style="border-left-width: medium;">{{pref}} Imp kWh</th>
48
+ <th>{{pref}} Imp Status</th>
49
+ <th>{{pref}} Exp kWh</th>
50
+ <th>{{pref}} Exp Status</th>
48
51
  {% endfor %}
49
52
  </tr>
50
- {% endfor %}
51
- </tbody>
52
- </table>
53
+ </thead>
54
+ <tbody>
55
+ {% for hh in hh_data %}
56
+ {% set start_str = hh.start_date|hh_format %}
57
+ <tr id="{{start_str}}">
58
+ <td style="white-space: nowrap">{{start_str}}</td>
59
+ <td>{{hh.import_kwh}}</td>
60
+ <td>{{hh.used_kwh}}</td>
61
+ <td>{{hh.displaced_kwh}}</td>
62
+ <td>{{hh.generated_kwh}}</td>
63
+ <td>{{hh.export_kwh}}</td>
64
+ <td>{{hh.parasitic_kwh}}</td>
65
+ {% for datum in hh.supplies %}
66
+ <td style="border-left-width: medium;"
67
+ >{{datum.import_kwh}}</td>
68
+ <td>{{datum.import_status}}</td>
69
+ <td>{{datum.export_kwh}}</td>
70
+ <td>{{datum.export_status}}</td>
71
+ {% endfor %}
72
+ </tr>
73
+ {% endfor %}
74
+ </tbody>
75
+ </table>
76
+ {% endblock %}
@@ -161,7 +161,7 @@
161
161
  Table of site level monthly kWh, MD kWh etc.</a>
162
162
  </li>
163
163
  <li>
164
- <a href="/sites/{{site.id}}/hh_data?year={{month_finish.year}}&amp;month={{month_finish.month}}">Table of hh data</a>
164
+ <a href="/e/sites/{{site.id}}/hh_data?start_year={{month_finish.year}}&amp;start_month={{month_finish.month}}">Table of hh data</a>
165
165
  </li>
166
166
  <li>
167
167
  <a href="/e/sites/{{site.id}}/site_snags">Site Snags</a>
chellow/utils.py CHANGED
@@ -17,8 +17,6 @@ from werkzeug.exceptions import BadRequest
17
17
 
18
18
  from zish import ZishException, loads
19
19
 
20
- url_root = ""
21
-
22
20
  HH = relativedelta(minutes=30)
23
21
  MONTH = relativedelta(months=1)
24
22
  YEAR = relativedelta(years=1)