chellow 1723807645.0.0__py3-none-any.whl → 1724062841.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
@@ -37,6 +37,7 @@ from chellow.models import (
37
37
  BatchFile,
38
38
  Bill,
39
39
  BillType,
40
+ CHANNEL_TYPES,
40
41
  Channel,
41
42
  ClockInterval,
42
43
  Comm,
@@ -193,13 +194,25 @@ def csv_bills_get():
193
194
 
194
195
  @e.route("/eras/<int:era_id>/add_channel")
195
196
  def channel_add_get(era_id):
197
+ channel_sets = {True: set(CHANNEL_TYPES), False: set(CHANNEL_TYPES)}
196
198
  era = Era.get_by_id(g.sess, era_id)
197
- channels = (
198
- g.sess.query(Channel)
199
- .filter(Channel.era == era)
199
+ channels = g.sess.scalars(
200
+ select(Channel)
201
+ .where(Channel.era == era)
200
202
  .order_by(Channel.imp_related, Channel.channel_type)
203
+ ).all()
204
+ for channel in channels:
205
+ channel_sets[channel.imp_related].remove(channel.channel_type)
206
+ add_channels = [
207
+ {"imp_related": imp_related, "channel_type": channel_type}
208
+ for imp_related, channel_set in channel_sets.items()
209
+ for channel_type in CHANNEL_TYPES
210
+ if channel_type in channel_set
211
+ ]
212
+
213
+ return render_template(
214
+ "channel_add.html", era=era, channels=channels, add_channels=add_channels
201
215
  )
202
- return render_template("channel_add.html", era=era, channels=channels)
203
216
 
204
217
 
205
218
  @e.route("/eras/<int:era_id>/add_channel", methods=["POST"])
@@ -13,10 +13,12 @@
13
13
  {% endblock %}
14
14
 
15
15
  {% block content %}
16
+
16
17
  <table>
17
18
  <caption>Existing Channels</caption>
18
19
  <thead>
19
20
  <tr>
21
+ <th>View</th>
20
22
  <th>Import / Export Related?</th>
21
23
  <th>Type</th>
22
24
  </tr>
@@ -24,6 +26,7 @@
24
26
  <tbody>
25
27
  {% for channel in channels %}
26
28
  <tr>
29
+ <td><a href="/e/channels/{{channel.id}}">View</a></td>
27
30
  <td>
28
31
  {% if channel.imp_related %}
29
32
  Import
@@ -39,23 +42,40 @@
39
42
  <tbody>
40
43
  </table>
41
44
 
42
- <form action="/e/eras/{{era.id}}/add_channel" method="post">
43
- <fieldset>
44
- <legend>Add a channel</legend>
45
- <label>Import / Export</label>
46
- <select name="imp_related">
47
- {% for lb, vl in (('Import Related', 'true'), ('Export Related', 'false')) %}
48
- {{input_option('is_import', vl, lb)}}
49
- {% endfor %}
50
- </select>
51
- <label>Channel Type</label>
52
- <select name="channel_type">
53
- {{input_option('channel_type', 'ACTIVE', 'ACTIVE')}}
54
- {{input_option('channel_type', 'REACTIVE_IMP', 'REACTIVE_IMP')}}
55
- {{input_option('channel_type', 'REACTIVE_EXP', 'REACTIVE_EXP')}}
56
- </select>
57
- <input type="submit" value="Add">
58
- </fieldset>
59
- </form>
45
+ <table>
46
+ <caption>Add Channels</caption>
47
+ <thead>
48
+ <tr>
49
+ <th>Import / Export Related?</th>
50
+ <th>Type</th>
51
+ <th>Add</th>
52
+ </tr>
53
+ </thead>
54
+ <tbody>
55
+ {% for channel in add_channels %}
56
+ <tr>
57
+ <td>
58
+ {% if channel.imp_related %}
59
+ Import
60
+ {% else %}
61
+ Export
62
+ {% endif %}
63
+ </td>
64
+ <td>
65
+ {{channel.channel_type}}
66
+ </td>
67
+ <td>
68
+ <form action="/e/eras/{{era.id}}/add_channel" method="post">
69
+ <fieldset>
70
+ <input type="hidden" name="imp_related" value="{{channel.imp_related|lower}}">
71
+ <input type="hidden" name="channel_type" value="{{channel.channel_type}}">
72
+ <input type="submit" value="Add">
73
+ </fieldset>
74
+ </form>
75
+ </td>
76
+ </tr>
77
+ {% endfor %}
78
+ <tbody>
79
+ </table>
60
80
 
61
81
  {% endblock %}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: chellow
3
- Version: 1723807645.0.0
3
+ Version: 1724062841.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=y8k961thtfmmTsWkt1CJXq-BhojQFXWPKsB_WruNrb0,215070
41
+ chellow/e/views.py,sha256=Kptq1umJm8_E3Dv__0kfllFDwspZxB9zGCZGvkG17NQ,215553
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
@@ -156,7 +156,7 @@ chellow/templates/user_roles.html,sha256=Pfjr4uApEmJl8t9s0qJTxigQcAVYw7gpV_ECE8c
156
156
  chellow/templates/users.html,sha256=dBB0yOvsoYbY_I9le1XGqZ0SlesUbWMqfRGlZOtOgNs,2244
157
157
  chellow/templates/e/asset_comparison.html,sha256=QyN3WMw8YoFaSWUvD2NOnRLdLdB3Kv6m3t8Id8Mb6_A,678
158
158
  chellow/templates/e/channel.html,sha256=R5fhdsHvhB7k57Rw_gviUQ7_EXBGwP05E691V1BUNSQ,2056
159
- chellow/templates/e/channel_add.html,sha256=X1hi0b-ZjchlQ2m7uZYCyqkqU-Qd1s3_5u4zsB_yySA,1479
159
+ chellow/templates/e/channel_add.html,sha256=szwQJBHx2kAoSFomXDHD0N_7PSd4drqOoAWhM-jvSqM,1676
160
160
  chellow/templates/e/channel_edit.html,sha256=OUkdiS2NBQ_w4gmxRxXAcRToM5BT8DWWJrtQMFs-GUU,2198
161
161
  chellow/templates/e/channel_snag.html,sha256=wBJ5KBfeJdAeRmaB0qu0AD9Z4nM5fn6tJ_8bNqTWtoo,1477
162
162
  chellow/templates/e/channel_snag_edit.html,sha256=sUFI4Ml3F1B35x8_t_Pz3hWuQN9Xtxr3kt4u8hdxNwY,1911
@@ -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-1723807645.0.0.dist-info/METADATA,sha256=Fc1pbuUcWllYt2MIy0LQ8X7aLkrmCvJ8rcy9mGraYYI,12241
369
- chellow-1723807645.0.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
370
- chellow-1723807645.0.0.dist-info/RECORD,,
368
+ chellow-1724062841.0.0.dist-info/METADATA,sha256=L-vg7G-J1TW5xMY0_1DmdfO8vbz6ON965HNP1o1FIvk,12241
369
+ chellow-1724062841.0.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
370
+ chellow-1724062841.0.0.dist-info/RECORD,,