chellow 1755011219.0.0__py3-none-any.whl → 1755598989.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 CHANGED
@@ -5730,6 +5730,51 @@ def supply_post(supply_id):
5730
5730
  f"successfully updated with the MSN {msn}. "
5731
5731
  )
5732
5732
  flash(msg)
5733
+
5734
+ if "new_llfc" in request.form:
5735
+ start_date_str = req_str("start_date")
5736
+ start_date = parse_hh_start(start_date_str)
5737
+ if start_date is None:
5738
+ raise BadRequest("The date of the MSN change is blank.")
5739
+
5740
+ llfc_code = req_str("llfc_code")
5741
+ llfc = supply.dno.get_llfc_by_code(g.sess, llfc_code)
5742
+ mpan_core = req_str("mpan_core")
5743
+ msg = ""
5744
+ era = supply.find_era_at(g.sess, start_date)
5745
+ if era is not None and era.start_date != start_date:
5746
+ era = supply.insert_era_at(g.sess, start_date)
5747
+ g.sess.commit()
5748
+ for era in supply.find_eras(g.sess, start_date, None):
5749
+ if era.imp_mpan_core == mpan_core:
5750
+ if era.imp_llfc.code == llfc.code:
5751
+ msg += (
5752
+ f"The era at {hh_format(era.start_date)} already has the "
5753
+ f"import LLFC {llfc.code}. "
5754
+ )
5755
+ else:
5756
+ era.imp_llfc = llfc
5757
+
5758
+ g.sess.commit()
5759
+ msg += (
5760
+ f"The era at {hh_format(era.start_date)} has been "
5761
+ f"successfully updated with the import LLFC {llfc.code}. "
5762
+ )
5763
+ elif era.exp_mpan_core == mpan_core:
5764
+ if era.exp_llfc.code == llfc.code:
5765
+ msg += (
5766
+ f"The era at {hh_format(era.start_date)} already has the "
5767
+ f"export LLFC {llfc.code}. "
5768
+ )
5769
+ else:
5770
+ era.exp_llfc = llfc
5771
+
5772
+ g.sess.commit()
5773
+ msg += (
5774
+ f"The era at {hh_format(era.start_date)} has been "
5775
+ f"successfully updated with the export LLFC {llfc.code}. "
5776
+ )
5777
+ flash(msg)
5733
5778
  return render_template("supply_post.html")
5734
5779
 
5735
5780
  except BadRequest as e:
@@ -11,7 +11,7 @@ from openpyxl import load_workbook
11
11
 
12
12
  from werkzeug.exceptions import BadRequest
13
13
 
14
- from chellow.utils import to_ct, to_utc
14
+ from chellow.utils import hh_max, hh_min, to_ct, to_utc
15
15
 
16
16
 
17
17
  class Title(Enum):
@@ -159,6 +159,12 @@ def _parse_row(bills, sheet, row, title_row):
159
159
  charge_period_end_naive = get_date_naive(
160
160
  sheet, row, column_map[Title.CHARGE_PERIOD_END]
161
161
  )
162
+ if charge_period_end_naive is None:
163
+ charge_period_end = None
164
+ else:
165
+ charge_period_end = to_utc(
166
+ to_ct(charge_period_end_naive) + relativedelta(hours=23, minutes=30)
167
+ )
162
168
 
163
169
  try:
164
170
  mprn_values = bills[mprn]
@@ -174,18 +180,25 @@ def _parse_row(bills, sheet, row, title_row):
174
180
  "reference": reference,
175
181
  "account": account,
176
182
  "issue_date": issue_date,
177
- "start_date": charge_period_from,
178
- "finish_date": to_utc(
179
- to_ct(charge_period_end_naive) + relativedelta(hours=23, minutes=30)
180
- ),
181
183
  "kwh": Decimal("0"),
182
184
  "breakdown": defaultdict(int, {}),
183
185
  "net_gbp": Decimal("0.00"),
184
186
  "vat_gbp": Decimal("0.00"),
185
187
  "gross_gbp": Decimal("0.00"),
186
- "raw_lines": str([(c.value) for c in sheet[row]]),
188
+ "raw_lines": [],
187
189
  "reads": [],
188
190
  }
191
+ if charge_period_from is not None:
192
+ if "start_date" in bill:
193
+ bill["start_date"] = hh_min(bill["start_date"], charge_period_from)
194
+ else:
195
+ bill["start_date"] = charge_period_from
196
+ if charge_period_end is not None:
197
+ if "finish_date" in bill:
198
+ bill["finish_date"] = hh_max(bill["finish_date"], charge_period_end)
199
+ else:
200
+ bill["finish_date"] = charge_period_end
201
+ bill["raw_lines"].append([c.value for c in sheet[row]])
189
202
 
190
203
  bd = bill["breakdown"]
191
204
  element_desc = get_value(sheet, row, column_map[Title.CHARGE_TYPE])
@@ -25,7 +25,7 @@ from chellow.models import (
25
25
  Supply,
26
26
  User,
27
27
  )
28
- from chellow.utils import csv_make_val, req_bool
28
+ from chellow.utils import csv_make_val, req_bool, utc_datetime_now
29
29
 
30
30
 
31
31
  FNAME = "ecoes_comparison"
@@ -146,6 +146,7 @@ def _process(
146
146
  report_run,
147
147
  ):
148
148
  writer = csv.writer(f, lineterminator="\n")
149
+ now = utc_datetime_now()
149
150
 
150
151
  mpans = []
151
152
 
@@ -274,6 +275,7 @@ def _process(
274
275
  chellow_pc = ""
275
276
  chellow_mtc = ""
276
277
  chellow_llfc = ""
278
+ chellow_llfc_desc = ""
277
279
  chellow_ssc = ""
278
280
  chellow_es = ""
279
281
  chellow_supplier = ""
@@ -287,6 +289,11 @@ def _process(
287
289
  chellow_supply_id = None
288
290
  chellow_era_id = None
289
291
  ignore = True
292
+ ecoes_dno_code = ecoes["mpan-core"][:2]
293
+ ecoes_dno = Party.get_dno_by_code(sess, ecoes_dno_code, now)
294
+ ecoes_llfc_desc = ""
295
+ chellow_site_code = ""
296
+ chellow_site_name = ""
290
297
  diffs = []
291
298
 
292
299
  try:
@@ -404,11 +411,17 @@ def _process(
404
411
  ignore = False
405
412
 
406
413
  chellow_llfc = llfc.code
407
- if ecoes["llfc"].zfill(3) != chellow_llfc:
414
+ chellow_llfc_desc = llfc.description
415
+ ecoes_llfc_code = ecoes["llfc"].zfill(3)
416
+ if ecoes_llfc_code != chellow_llfc:
408
417
  problem += "The LLFCs don't match. "
409
418
  ignore = False
410
419
  diffs.append("llfc")
411
420
 
421
+ ecoes_llfc = ecoes_dno.find_llfc_by_code(sess, ecoes_llfc_code, now)
422
+ if ecoes_llfc is not None:
423
+ ecoes_llfc_desc = ecoes_llfc.description
424
+
412
425
  chellow_ssc = era.ssc
413
426
  if chellow_ssc is None:
414
427
  chellow_ssc = ""
@@ -466,6 +479,10 @@ def _process(
466
479
  ignore = False
467
480
  diffs.append("gsp_group")
468
481
 
482
+ chellow_site = era.get_physical_site(sess)
483
+ chellow_site_code = chellow_site.code
484
+ chellow_site_name = chellow_site.name
485
+
469
486
  chellow_msn = era.msn
470
487
 
471
488
  if set([m.strip() for m in chellow_msn.split(",")]) != set(
@@ -503,8 +520,10 @@ def _process(
503
520
  "ecoes_mtc_date": _parse_date(ecoes["mtc-date"]),
504
521
  "chellow_mtc": chellow_mtc,
505
522
  "ecoes_llfc": ecoes["llfc"],
523
+ "ecoes_llfc_desc": ecoes_llfc_desc,
506
524
  "ecoes_llfc_from": _parse_date(ecoes["llfc-from"]),
507
525
  "chellow_llfc": chellow_llfc,
526
+ "chellow_llfc_desc": chellow_llfc_desc,
508
527
  "ecoes_ssc": ecoes["ssc"],
509
528
  "chellow_ssc": chellow_ssc,
510
529
  "ecoes_es": ecoes["energisation-status"],
@@ -533,6 +552,8 @@ def _process(
533
552
  "address": ", ".join(
534
553
  [a for a in address_lines if len(a) > 0 and a != "NULL"]
535
554
  ),
555
+ "chellow_site_code": chellow_site_code,
556
+ "chellow_site_name": chellow_site_name,
536
557
  }
537
558
  writer.writerow(csv_make_val(values[t]) for t in titles)
538
559
  values["chellow_supplier_contract_id"] = chellow_supplier_contract_id
@@ -64,26 +64,21 @@
64
64
  <caption>{{vals['mpan_core_no_spaces']}}</caption>
65
65
  <thead>
66
66
  <tr>
67
- <th rowspan="2">Mpan Core</th>
68
- <th rowspan="2">Supplier Contract</th>
69
- <th rowspan="2">Edit Era</th>
70
- <th rowspan="2">Edit Supply</th>
67
+ <th>Source</th>
68
+ <th>Mpan Core</th>
69
+ <th>Supplier Contract</th>
70
+ <th>Edit Era</th>
71
+ <th>Edit Supply</th>
71
72
  {% for diff in vals['diffs'] %}
72
- <th colspan="2">{{diff}}</th>
73
- {% endfor %}
74
- <th rowspan="2">Problem</th>
75
- <th rowspan="2">Fix</th>
76
- <th rowspan="2">ECOES Address</th>
77
- </tr>
78
- <tr>
79
- {% for diff in vals['diffs'] %}
80
- <th>Chellow</th>
81
- <th>ECOES</th>
73
+ <th>{{diff}}</th>
82
74
  {% endfor %}
75
+ <th>Problem</th>
76
+ <th>Site</th>
83
77
  </tr>
84
78
  </thead>
85
79
  <tbody>
86
80
  <tr>
81
+ <td>Chellow</td>
87
82
  <td>
88
83
  {% if vals['chellow_supply_id'] is none %}
89
84
  {{vals['mpan_core']}}
@@ -99,15 +94,55 @@
99
94
  </td>
100
95
  <td>
101
96
  {% if vals['chellow_era_id'] is not none %}
102
- [<a href="/e/eras/{{vals['chellow_era_id']}}/edit">edit</a>]</td>
97
+ [<a href="/e/eras/{{vals['chellow_era_id']}}/edit">edit</a>]
103
98
  {% endif %}
99
+ </td>
104
100
  <td>
105
101
  {% if vals['chellow_supply_id'] is not none %}
106
102
  [<a href="/e/supplies/{{vals['chellow_supply_id']}}/edit">edit</a>]
107
103
  {% endif %}
108
104
  </td>
109
105
  {% for diff in vals['diffs'] %}
110
- <td>{{vals['chellow_' + diff]}}</td>
106
+ <td>
107
+ {{vals['chellow_' + diff]}}
108
+ {% if diff == 'llfc' %}
109
+ - {{vals['chellow_' + diff + '_desc']}}
110
+ <form hx-post="/e/supplies/{{vals['chellow_supply_id']}}">
111
+ <fieldset>
112
+ <input type="hidden" name="llfc_code" value="{{vals['ecoes_llfc']}}">
113
+ <input type="hidden" name="mpan_core" value="{{vals['mpan_core']}}">
114
+ <input type="hidden" name="start_date"
115
+ value="{{vals['ecoes_llfc_from_date']}}">
116
+ <input type="submit" name="new_llfc" value="Fix">
117
+ </fieldset>
118
+ </form>
119
+ {% elif diff == 'msn' %}
120
+ <form hx-post="/e/supplies/{{vals['chellow_supply_id']}}">
121
+ <fieldset>
122
+ <input type="hidden" name="msn" value="{{vals['ecoes_msn']}}">
123
+ <input type="hidden" name="start_date"
124
+ value="{{vals['ecoes_msn_install_date']}}">
125
+ <input type="submit" name="new_msn" value="Fix MSN">
126
+ </fieldset>
127
+ </form>
128
+ {% endif %}
129
+ </td>
130
+ {% endfor %}
131
+ <td rowspan="2">{{vals['problem']}}</td>
132
+ <td>{{vals['chellow_site_code']}} {{vals['chellow_site_name']}}</td>
133
+ </tr>
134
+ <tr>
135
+ <td>
136
+ ECOES
137
+ </td>
138
+ <td>
139
+ </td>
140
+ <td>
141
+ </td>
142
+ <td>
143
+ <td>
144
+ </td>
145
+ {% for diff in vals['diffs'] %}
111
146
  <td>{{vals['ecoes_' + diff]}}
112
147
  {% if diff == 'msn' %}
113
148
  - {{vals['ecoes_msn_install_date']}}
@@ -116,7 +151,7 @@
116
151
  {% elif diff == 'mtc' %}
117
152
  - {{vals['ecoes_mtc_date']}}
118
153
  {% elif diff == 'llfc' %}
119
- - {{vals['ecoes_llfc_from']}}
154
+ {{vals['ecoes_llfc_desc']}} - From {{vals['ecoes_llfc_from']}}
120
155
  {% elif diff == 'mop' %}
121
156
  - {{vals['ecoes_mop_appoint_date']}}
122
157
  {% elif diff == 'gsp_group' %}
@@ -124,19 +159,6 @@
124
159
  {% endif %}
125
160
  </td>
126
161
  {% endfor %}
127
- <td>{{vals['problem']}}</td>
128
- <td>
129
- {% if 'msn' in vals['diffs'] %}
130
- <form hx-post="/e/supplies/{{vals['chellow_supply_id']}}">
131
- <fieldset>
132
- <input type="hidden" name="msn" value="{{vals['ecoes_msn']}}">
133
- <input type="hidden" name="start_date"
134
- value="{{vals['ecoes_msn_install_date']}}">
135
- <input type="submit" name="new_msn" value="Fix MSN">
136
- </fieldset>
137
- </form>
138
- {% endif %}
139
- </td>
140
162
  <td>{{vals['address']}}</td>
141
163
  </tr>
142
164
  </tbody>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chellow
3
- Version: 1755011219.0.0
3
+ Version: 1755598989.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)
@@ -44,7 +44,7 @@ chellow/e/system_price.py,sha256=6w5J7bzwFAZubE2zdOFRiS8IIrVP8hkoIOaG2yCt-Ic,623
44
44
  chellow/e/tlms.py,sha256=pyL32hPiYd09FbpXVMnBjHsWFEQHs-Az945V7EShGiY,9116
45
45
  chellow/e/tnuos.py,sha256=NBmc-f3oezrl4gviAKobljHfICTpBKxxxEGBGJi_lRk,4927
46
46
  chellow/e/triad.py,sha256=uQIngSrz8irBXQ0Rp_s8nAUzu-y2Ms7aj4B38_Ff8y8,13720
47
- chellow/e/views.py,sha256=lHE1MAfVmv_4U8Yikirduf_DeDky8KAhbzSMReJLz7I,220455
47
+ chellow/e/views.py,sha256=EJbKApeJsRqgjJdOZRk5Oah3HlA1ys5vJXUhF6LoYQA,222489
48
48
  chellow/e/bill_parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
49
  chellow/e/bill_parsers/activity_mop_stark_xlsx.py,sha256=opjXRrqrgBTbSKzL0JfTLP0fnz3DL3oRZZ4P0DifQ3I,4119
50
50
  chellow/e/bill_parsers/annual_mop_stark_xlsx.py,sha256=-HMoIfa_utXYKA44RuC0Xqv3vd2HLeQU_4P0iBUd3WA,4219
@@ -67,7 +67,7 @@ chellow/e/bill_parsers/settlement_dc_stark_xlsx.py,sha256=osCpUYUdLcPtlo7ngXWGw0
67
67
  chellow/e/bill_parsers/sse_edi.py,sha256=L85DOfNkqexeEIEr8pCBn_2sHJI-zEaw6cogpE3YyYM,15204
68
68
  chellow/e/bill_parsers/sww_xls.py,sha256=QEjiuvwvr5FuWCfqqVw8LaA_vZyAKsvRAS5fw3xtFhM,7533
69
69
  chellow/gas/bill_import.py,sha256=w0lPgK_Drzh8rtnEBQe3qFuxrgzZ6qQSgpaGrrGznMU,6549
70
- chellow/gas/bill_parser_bgs_xlsx.py,sha256=ZuLts8Y31gxtCQoXJq2CQRRMMpYbAWqsbfMB1S6fPqU,7757
70
+ chellow/gas/bill_parser_bgs_xlsx.py,sha256=r3lWjs_QbT3KgBi7wNVAXUV-9Mm7tBRyvvcftqsY1mA,8265
71
71
  chellow/gas/bill_parser_csv.py,sha256=Ecdy-apFT-mWAxddAsM4k1s-9-FpIaOfjP0oFc0rdQg,5557
72
72
  chellow/gas/bill_parser_engie_edi.py,sha256=Ko0vZP-QdVQ1uuhS_5cdrii60_cM4b_LFJMoY0pZqnk,8950
73
73
  chellow/gas/bill_parser_total_edi.py,sha256=8HZH5Le24bVNFDc7vaKbauMaYR-n9P6u0ZG7gDdqbIA,11325
@@ -104,7 +104,7 @@ chellow/reports/report_bills.py,sha256=LP7XDxzO0Fp10c8xDE67e4tHTEc7nN74ESQBy762N
104
104
  chellow/reports/report_csv_llfcs.py,sha256=mMB06b6Jems5kcQU4H4Le_fyKgVr8THP8BCx3pkvg5E,1903
105
105
  chellow/reports/report_csv_site_hh_data.py,sha256=ik0OkGVo1bfTXLdcT3gPUHnxSkSdorzZheP3qgnOR5c,4331
106
106
  chellow/reports/report_csv_site_snags.py,sha256=AuAy6vjL0g7vwPPAZhBqxOyITL9_jnyFj012MnUcxxk,2627
107
- chellow/reports/report_ecoes_comparison.py,sha256=T2jeXQQfD_DyCwzVKyAOpyLKKtPP1uxx0erNFkptFX8,21817
107
+ chellow/reports/report_ecoes_comparison.py,sha256=ZI-wHFbWHO_MzqJ8zFZb8rJMi_O1J4ymQEoNjQ7XltQ,22784
108
108
  chellow/reports/report_g_monthly_duration.py,sha256=aEY3hSBaCxjOBgWZYWZH38TmZEO5MpOfpOQe2Lhfpmo,18288
109
109
  chellow/reports/report_g_supplies_snapshot.py,sha256=9xB6RDrnbgxuomMcP1b1yEP4kOnEJ34WgKpyxLTprOQ,3998
110
110
  chellow/reports/report_g_supply_virtual_bill.py,sha256=EaYrB8PHJIXrUuhiZ7dwUlbNBkuyJebQHrdc308_z1o,3653
@@ -148,7 +148,7 @@ chellow/templates/rate_server.html,sha256=SezuwdKhHRZ00-R_S6ttKiZ-nvRpwozV9QcIMf
148
148
  chellow/templates/report_run.html,sha256=O_wjIu43S-mKVyZyku3dJJdvyck3rAgEdhw59TsCcK0,4040
149
149
  chellow/templates/report_run_asset_comparison.html,sha256=VYCCUmIC7Mfe7uuaAHb6ihiK6zsqeTlQbzgtzLqR3zg,2305
150
150
  chellow/templates/report_run_bill_check.html,sha256=I4VLSTOGE7cjjZggG3EAI9EW-2b7e0oOTs-S7FlknS4,5110
151
- chellow/templates/report_run_ecoes_comparison.html,sha256=LlMlcui3zJ2ZZggFBvWAErHlf5aE5mV0OQoiqujXpQs,4184
151
+ chellow/templates/report_run_ecoes_comparison.html,sha256=EYjmdiQ14lt_CW7e6mdyQYec1t-rg8g85wFb1757YpI,4812
152
152
  chellow/templates/report_run_g_bill_check.html,sha256=tOXl_mjR__foYKiOYflJbK-459actAtjzv8rfuL3TwM,4851
153
153
  chellow/templates/report_run_missing_e_bills.html,sha256=l5idQhfaNhMvvzIRv-iqCpeDnYl_wgs6-mZMBOmuyR8,2447
154
154
  chellow/templates/report_run_monthly_duration_org.html,sha256=gGNGJ4Q50q4BtIMi98rhO-7NqRHcsFUmbj2qzeOLejw,1713
@@ -386,6 +386,6 @@ chellow/templates/g/supply_note_edit.html,sha256=b8mB6_ucBwoljp03iy6AgVaZUhGw3-1
386
386
  chellow/templates/g/supply_notes.html,sha256=6epNmZ3NKdXZz27fvmRUGeffg_oc1kmwuBeyRzQe3Rg,854
387
387
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
388
388
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
389
- chellow-1755011219.0.0.dist-info/METADATA,sha256=LR04CnNjbSXoLGxeZWwX2C97Zj3DBdM8lNiUR4t21pg,12519
390
- chellow-1755011219.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
391
- chellow-1755011219.0.0.dist-info/RECORD,,
389
+ chellow-1755598989.0.0.dist-info/METADATA,sha256=FhPH5NLhdbXRUAOO14Em-legw7CpFMXAIo7wRI0rwvQ,12519
390
+ chellow-1755598989.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
391
+ chellow-1755598989.0.0.dist-info/RECORD,,