chellow 1724751676.0.0__py3-none-any.whl → 1724831616.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/gas/views.py CHANGED
@@ -17,7 +17,7 @@ from flask import (
17
17
  request,
18
18
  )
19
19
 
20
- from sqlalchemy import false, select, text, true
20
+ from sqlalchemy import false, func, select, text, true
21
21
  from sqlalchemy.orm import joinedload
22
22
 
23
23
 
@@ -352,9 +352,18 @@ def supply_edit_post(g_supply_id):
352
352
  def batches_get():
353
353
  g_contract_id = req_int("g_contract_id")
354
354
  g_contract = GContract.get_by_id(g.sess, g_contract_id)
355
- g_batches = (
356
- g.sess.query(GBatch)
357
- .filter(GBatch.g_contract == g_contract)
355
+ g_batches = g.sess.execute(
356
+ select(
357
+ GBatch,
358
+ func.count(GBill.id),
359
+ func.coalesce(func.sum(GBill.net), 0),
360
+ func.coalesce(func.sum(GBill.vat), 0),
361
+ func.coalesce(func.sum(GBill.gross), 0),
362
+ func.coalesce(func.sum(GBill.kwh), 0),
363
+ )
364
+ .join(GBill, isouter=True)
365
+ .where(GBatch.g_contract == g_contract)
366
+ .group_by(GBatch.id)
358
367
  .order_by(GBatch.reference.desc())
359
368
  )
360
369
  return render_template("batches.html", g_contract=g_contract, g_batches=g_batches)
@@ -225,9 +225,12 @@ def _process(
225
225
  ecoes_row["mpan_spaces"] = mpan_spaces
226
226
  if mpan_spaces in ecoes_mpans:
227
227
  prev_row = ecoes_mpans[mpan_spaces]
228
- prev_row["meter_count"] += 1
228
+ msn = ecoes_row["msn"]
229
+ if len(msn) > 0:
230
+ prev_msns = prev_row["msn"].split(",")
231
+ prev_msns.append(msn)
232
+ prev_row["msn"] = ", ".join(prev_msns)
229
233
  else:
230
- ecoes_row["meter_count"] = 1
231
234
  ecoes_mpans[mpan_spaces] = ecoes_row
232
235
 
233
236
  titles = (
@@ -295,15 +298,6 @@ def _process(
295
298
  ecoes_disconnected = ecoes_es == ""
296
299
  current_chell = mpan_spaces in mpans
297
300
 
298
- if ecoes["meter_count"] > 1:
299
- problem += (
300
- f"There are {ecoes['meter_count']} meters associated with this MPAN "
301
- f"core in ECOES, but Chellow only supports one meter per supply at the "
302
- f"moment. If there really should be multiple meters for this supply, "
303
- f"let me know and I'll add support for it in Chellow."
304
- )
305
- ignore = False
306
-
307
301
  if ecoes_disconnected and current_chell:
308
302
  problem += "Disconnected in ECOES, but current in Chellow. "
309
303
  ignore = False
@@ -471,7 +465,9 @@ def _process(
471
465
 
472
466
  chellow_msn = era.msn
473
467
 
474
- if chellow_msn.split(",")[0] != ecoes["msn"]:
468
+ if set([m.strip() for m in chellow_msn.split(",")]) != set(
469
+ [m.strip() for m in ecoes["msn"].split(",")]
470
+ ):
475
471
  problem += "The meter serial numbers don't match. "
476
472
  diffs.append("msn")
477
473
  if mpan_spaces not in ignore_mpan_cores_msn:
@@ -243,114 +243,114 @@
243
243
  {% set bill = bill_dict['bill'] %}
244
244
  {% set rows_high = bill_dict['rows_high'] %}
245
245
  {% if bill_dict.first_collapsible %}
246
- <tr style="background-color: silver; cursor: pointer;">
247
- <td style="text-decoration: none; padding-top: 0px; padding-bottom: 0px; font-size: x-small;"
248
- colspan="{{9 + imp_bills['inner_headers']|length * 4 + imp_bills['num_outer_cols'] * 5}}"
249
- class="expander_{{bill_dict.collapse_id}}"
250
- onClick="expandBills({{bill_dict.collapse_id}})">
251
- +
252
- </td>
253
- <td style="text-decoration: none; display: none; padding-top: 0px; padding-bottom: 0px; font-size: x-small;"
254
- colspan="{{9 + imp_bills['inner_headers']|length * 4 + imp_bills['num_outer_cols'] * 5}}"
255
- class="collapser_{{bill_dict.collapse_id}}"
256
- onClick="collapseBills({{bill_dict.collapse_id}})">
257
- -
258
- </td>
259
- </tr>
246
+ <tr style="background-color: silver; cursor: pointer;">
247
+ <td style="text-decoration: none; padding-top: 0px; padding-bottom: 0px; font-size: x-small;"
248
+ colspan="{{9 + imp_bills['inner_headers']|length * 4 + imp_bills['num_outer_cols'] * 5}}"
249
+ class="expander_{{bill_dict.collapse_id}}"
250
+ onClick="expandBills({{bill_dict.collapse_id}})">
251
+ +
252
+ </td>
253
+ <td style="text-decoration: none; display: none; padding-top: 0px; padding-bottom: 0px; font-size: x-small;"
254
+ colspan="{{9 + imp_bills['inner_headers']|length * 4 + imp_bills['num_outer_cols'] * 5}}"
255
+ class="collapser_{{bill_dict.collapse_id}}"
256
+ onClick="collapseBills({{bill_dict.collapse_id}})">
257
+ -
258
+ </td>
259
+ </tr>
260
260
  {% endif %}
261
261
 
262
262
  <tr {% if bill_dict.collapsible %}
263
263
  class="collapsible_{{bill_dict.collapse_id}}"
264
264
  style="display: none; background-color: silver;"
265
265
  {% endif %}>
266
- <td rowspan="{{ rows_high }}">
266
+ <td rowspan="{{ rows_high }}">
267
267
  <a href="/e/supplier_bills/{{bill.id}}">View</a>
268
- </td>
269
- <td rowspan="{{ rows_high }}">
270
- <label title="{{bill.start_date|hh_format}}">{{bill.start_date|hh_format('date')}}</label>
271
- </td>
272
- <td rowspan="{{ rows_high }}">
273
- <label title="{{ bill.finish_date|hh_format }}">{{ bill.finish_date|hh_format('date') }}</label>
274
- </td>
275
- <td rowspan="{{ rows_high }}">
276
- <a href="/e/supplier_batches/{{bill.batch.id}}">{{bill.batch.reference}}</a>
277
- </td>
278
- <td rowspan="{{ rows_high }}">{{ bill.reference }}</td>
279
- <td rowspan="{{ rows_high }}">{{ bill.kwh }}</td>
280
- <td rowspan="{{ rows_high }}">{{ bill.net }}</td>
281
- <td rowspan="{{ rows_high }}">{{ bill.vat }}</td>
282
- <td rowspan="{{ rows_high }}">
283
- <a href="/bill_types/{{bill.bill_type.id}}"
268
+ </td>
269
+ <td rowspan="{{ rows_high }}">
270
+ <label title="{{bill.start_date|hh_format}}">{{bill.start_date|hh_format('date')}}</label>
271
+ </td>
272
+ <td rowspan="{{ rows_high }}">
273
+ <label title="{{ bill.finish_date|hh_format }}">{{ bill.finish_date|hh_format('date') }}</label>
274
+ </td>
275
+ <td rowspan="{{ rows_high }}">
276
+ <a href="/e/supplier_batches/{{bill.batch.id}}">{{bill.batch.reference}}</a>
277
+ </td>
278
+ <td rowspan="{{ rows_high }}">{{ bill.reference }}</td>
279
+ <td rowspan="{{ rows_high }}">{{ bill.kwh }}</td>
280
+ <td rowspan="{{ rows_high }}">{{ bill.net }}</td>
281
+ <td rowspan="{{ rows_high }}">{{ bill.vat }}</td>
282
+ <td rowspan="{{ rows_high }}">
283
+ <a href="/bill_types/{{bill.bill_type.id}}"
284
284
  title="{{bill.bill_type.description}}">{{bill.bill_type.code}}</a>
285
- </td>
286
- {% for read_row in read_rows %}
285
+ </td>
286
+ {% for read_row in read_rows %}
287
287
  {% if not loop.first %}
288
- <tr {% if bill_dict.collapsible %}
289
- class="collapsible_{{bill_dict.collapse_id}}"
290
- style="display: none; background-color: silver;"
291
- {% endif %}>
288
+ <tr {% if bill_dict.collapsible %}
289
+ class="collapsible_{{bill_dict.collapse_id}}"
290
+ style="display: none; background-color: silver;"
291
+ {% endif %}>
292
292
  {% endif %}
293
293
  {% for read in read_row['inner_reads'] %}
294
- <td style="border-right: none;">
294
+ <td style="border-right: none;">
295
295
  {% if read %}
296
- <a title="{{ read.previous_date|hh_format }} {{ read.msn }}">{{ read.previous_value }}</a>
296
+ <label title="{{ read.previous_date|hh_format }} {{ read.msn }}">{{ read.previous_value }}</label>
297
297
  {% endif %}
298
- </td>
299
- <td style="border-left: none; text-align: right;">
298
+ </td>
299
+ <td style="border-left: none; text-align: right;">
300
300
  {% if read %}
301
- {{ read.previous_type.code }}
301
+ <a href="/e/read_types/{{read.previous_type.id}}" title="{{read.previous_type.description}}">{{ read.previous_type.code }}</a>
302
302
  {% endif %}
303
- </td>
304
- <td style="border-right: none;">
303
+ </td>
304
+ <td style="border-right: none;">
305
305
  {% if read %}
306
- <a title="{{ read.present_date|hh_format }} {{ read.msn }}">{{ read.present_value }}</a>
306
+ <label title="{{ read.present_date|hh_format }} {{ read.msn }}">{{ read.present_value }}</label>
307
307
  {% endif %}
308
- </td>
309
- <td style="border-left: none; text-align: right;">
308
+ </td>
309
+ <td style="border-left: none; text-align: right;">
310
310
  {% if read %}
311
- {{ read.present_type.code }}
311
+ <a href="/e/read_types/{{read.present_type.id}}" title="{{read.present_type.description}}">{{ read.present_type.code }}</a>
312
312
  {% endif %}
313
- </td>
313
+ </td>
314
314
  {% endfor %}
315
315
  {% for read in read_row['outer_reads'] %}
316
- <td>
316
+ <td>
317
317
  {% if read %}
318
- {% if read.tpr %}
319
- <a href="/e/tprs/{{read.tpr.id}}">{{read.tpr.code}}</a>
320
- {% else %}
321
- MD
322
- {% endif %}
318
+ {% if read.tpr %}
319
+ <a href="/e/tprs/{{read.tpr.id}}">{{read.tpr.code}}</a>
320
+ {% else %}
321
+ MD
322
+ {% endif %}
323
323
  {% endif %}
324
- </td>
325
- <td style="border-right: none;">
324
+ </td>
325
+ <td style="border-right: none;">
326
326
  {% if read %}
327
- <a title="{{read.previous_date|hh_format}} {{read.msn}}">{{read.previous_value}}</a>
327
+ <label title="{{read.previous_date|hh_format}} {{read.msn}}">{{read.previous_value}}</label>
328
328
  {% endif %}
329
- </td>
330
- <td style="border-left: none; text-align: right;">
329
+ </td>
330
+ <td style="border-left: none; text-align: right;">
331
331
  {% if read %}
332
- {{read.previous_type.code}}
332
+ <a href="/e/read_types/{{read.previous_type.id}}" title="{{read.previous_type.description}}">{{read.previous_type.code}}</a>
333
333
  {% endif %}
334
- </td>
335
- <td style="border-right: none;">
334
+ </td>
335
+ <td style="border-right: none;">
336
336
  {% if read %}
337
- <a title="{{read.present_date|hh_format}} {{read.msn}}">{{read.present_value}}</a>
337
+ <label title="{{read.present_date|hh_format}} {{read.msn}}">{{read.present_value}}</label>
338
338
  {% endif %}
339
- </td>
340
- <td style="border-left: none; text-align: right;">
339
+ </td>
340
+ <td style="border-left: none; text-align: right;">
341
341
  {% if read %}
342
- {{read.present_type.code}}
342
+ <a href="/e/read_types/{{read.present_type.id}}" title="{{read.present_type.description}}">{{read.present_type.code}}</a>
343
343
  {% endif %}
344
- </td>
345
- {% if not loop.first %}
346
- </tr>
347
- {% endif %}
348
- {% endfor %}
349
- {% endfor %}
344
+ </td>
345
+ {% if not loop.first %}
346
+ </tr>
347
+ {% endif %}
348
+ {% endfor %}
349
+ {% endfor %}
350
350
  </tr>
351
- {% endfor %}
351
+ {% endfor %}
352
352
  </tbody>
353
- </table>
353
+ </table>
354
354
 
355
355
  <table>
356
356
  {% set exp_bills = era_bundle['exp_bills'] %}
@@ -14,17 +14,28 @@
14
14
  <table>
15
15
  <thead>
16
16
  <tr>
17
+ <th>View</th>
17
18
  <th>Reference</th>
18
19
  <th>Description</th>
20
+ <th>Number Of Bills</th>
21
+ <th>Net GBP</th>
22
+ <th>VAT GBP</th>
23
+ <th>Gross GBP</th>
24
+ <th>kWh</th>
19
25
  </tr>
20
26
  </thead>
21
27
  <tbody>
22
- {% for g_batch in g_batches %}
28
+ {% for row in g_batches %}
29
+ {% set g_batch = row[0] %}
23
30
  <tr>
24
- <td>
25
- <a href="/g/batches/{{g_batch.id}}">{{g_batch.reference}}</a>
26
- </td>
31
+ <td><a href="/g/batches/{{g_batch.id}}">View</a></td>
32
+ <td>{{g_batch.reference}}</td>
27
33
  <td>{{g_batch.description}}</td>
34
+ <td>{{ "{:,}".format(row[1]) }}</td>
35
+ <td>{{ "£{:,}".format(row[2]) }}</td>
36
+ <td>{{ "£{:,}".format(row[3]) }}</td>
37
+ <td>{{ "£{:,}".format(row[4]) }}</td>
38
+ <td>{{ "{:,}".format(row[5]) }}</td>
28
39
  </tr>
29
40
  {% endfor %}
30
41
  </tbody>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: chellow
3
- Version: 1724751676.0.0
3
+ Version: 1724831616.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)
@@ -66,7 +66,7 @@ chellow/gas/cv.py,sha256=4cdYYQ8Qak6NeYdBCB4YaQ0jX8-UkaydIIdibCQuXxM,7344
66
66
  chellow/gas/dn_rate_parser.py,sha256=Mq8rAcUEUxIQOks59bsCKl8GrefvoHbrTCHqon9N0z0,11340
67
67
  chellow/gas/engine.py,sha256=jT7m6vddi5GnWd51wCYEVhBS-LZEn1T9ggZX7Y9HGK0,25263
68
68
  chellow/gas/transportation.py,sha256=Bkg8TWOs-v0ES-4qqwbleiOhqbE_t2KauUx9JYMZELM,5300
69
- chellow/gas/views.py,sha256=N_vj5A3ia0FmLm2M18bcZQTGpVQXd7oHrIiFXa44aLo,57511
69
+ chellow/gas/views.py,sha256=zOlJnL6eVq7Tag-0NMabzCPQk5AoTrclEz-923pbwAE,57851
70
70
  chellow/reports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
71
71
  chellow/reports/report_109.py,sha256=FmRWG8wQC97cj0nqQH7mrfbYesRIKWXQLh6ERHvtHrU,11212
72
72
  chellow/reports/report_111.py,sha256=AlYjvCDpGNe1qBuzW52EONWDsFaIVElug0Vpe9qm1PY,28169
@@ -94,7 +94,7 @@ chellow/reports/report_bills.py,sha256=AHW6tiZAOE0gXDfencPvemE4zqK6eTqfN8_bWQ4RT
94
94
  chellow/reports/report_csv_llfcs.py,sha256=OHSbP64lQ6dlAMcQYgvdANlA4lQyF0iBlwk7V9c9nuo,1944
95
95
  chellow/reports/report_csv_site_hh_data.py,sha256=yWhEoGGyg_ctM8T55raksTPRJ5ycVO6lVfUx5tRBzTQ,4372
96
96
  chellow/reports/report_csv_site_snags.py,sha256=gG2sYQrLoIBwCoMUC8rhmAL7Kffh_rvNb9UOX7cYDko,2668
97
- chellow/reports/report_ecoes_comparison.py,sha256=PGDJKI2f6DCVCH0xcp--BzXWAWFfTDGgcKVQnfqxBKg,21653
97
+ chellow/reports/report_ecoes_comparison.py,sha256=CaeMCpLifP-kh2O9MZPs0EYf4UqksL-xFjwki41DTRA,21444
98
98
  chellow/reports/report_g_monthly_duration.py,sha256=FMMFIWFfGW2Bd9Excpf4LLXXqQ-fbnZZ_KfNa1VaPqA,13034
99
99
  chellow/reports/report_g_supplies_snapshot.py,sha256=0M0x_0o0985Hu45gUJJJwzfx0DDOAuXBJ1UVUDbQ36g,4718
100
100
  chellow/reports/report_g_supply_virtual_bill.py,sha256=x_KtQ02dwgmXvAEUXJ1poK0BRwqxa-GcbJ5pddEina0,3694
@@ -311,7 +311,7 @@ chellow/templates/e/supplier_rate_script_add.html,sha256=Yf2LZEIHbL7qT6oxBCtPf0Z
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
313
  chellow/templates/e/supply_edit.html,sha256=Ef4ivmSvj9NAb1Uy43S3TCwheCffV457bdpaoD8XZ_s,2723
314
- chellow/templates/e/supply_eras.html,sha256=y_Y2V20Q-tyyw6iRP3lE1ZQCAZM7CaRtEr1_CcDICuc,19539
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
317
317
  chellow/templates/e/supply_note_add.html,sha256=wsrG7P38h8fj63zVAZXfLogdYxIKnn8qxEJFr3Fna4k,553
@@ -324,7 +324,7 @@ chellow/templates/e/tprs.html,sha256=jk1jm8CTcO3zYOOZFu9XOOLSG_ZFAgblReh-Di-bkug
324
324
  chellow/templates/g/batch.html,sha256=jOr_6OmS4sgFFV4y4NG1KZMM7r7w25qtMuApN_jTyBI,3909
325
325
  chellow/templates/g/batch_add.html,sha256=WEK6NAvxsRd0gmJOqYSBS5ehZKVahbX49uiHAoyCwhg,1035
326
326
  chellow/templates/g/batch_edit.html,sha256=hA0eowzmwaA5vwt4L23DZNKtT_PD8FLCBuSo5IktWmI,1428
327
- chellow/templates/g/batches.html,sha256=mnzLroYfhwvL5gFK1PNtI-vS7GcDtcggNd0E15Shtfw,730
327
+ chellow/templates/g/batches.html,sha256=T6_2ndBfIYyzHrZzwaELYGCcvdFvsLFmn3zSQENnCNE,1108
328
328
  chellow/templates/g/bill.html,sha256=S8moZ06CDl4_nQQgqyy4mdkyhfvgoQJGZS8ppsluT_E,3455
329
329
  chellow/templates/g/bill_add.html,sha256=sDSpUgEbdalDsea1Ma5lgVRgtbFf0bZ042jUdOFeDDk,1674
330
330
  chellow/templates/g/bill_edit.html,sha256=ynfUR_lZXLgTK3T0x9GjzAHahuR823ykMpjCWrY8ot8,2754
@@ -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-1724751676.0.0.dist-info/METADATA,sha256=7AN6Q_gJi4wcmNKLFhGNag5Ra0i2ZpULKIMFyECV2OE,12241
369
- chellow-1724751676.0.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
370
- chellow-1724751676.0.0.dist-info/RECORD,,
368
+ chellow-1724831616.0.0.dist-info/METADATA,sha256=OyyLnpyN4SIdhUqdsS2mrvsqFjReOeJWjUcyx-LKFeU,12241
369
+ chellow-1724831616.0.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
370
+ chellow-1724831616.0.0.dist-info/RECORD,,