irie 0.0.3__py3-none-any.whl → 0.0.5__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 irie might be problematic. Click here for more details.

@@ -164,26 +164,57 @@ function handleClickedTab(tabLink) {
164
164
  }
165
165
 
166
166
  function handleCorridorUpdate(event) {
167
- // Prevent the form from submitting in the traditional way
168
- event.preventDefault();
169
-
170
- // Get the form element
171
- const form = event.target;
172
- const tab = "tab1";
173
-
174
- // Close all bridge tabs
175
- initializedTabs.slice(1, initializedTabs.length).forEach(tab => {
176
- if (tab.startsWith('c')) {
167
+ // Prevent the form from submitting in the traditional way
168
+ event.preventDefault();
169
+
170
+ // Get the form element
171
+ const form = event.target;
172
+ const tab = "tab1";
173
+
174
+ // Normalize form fields with "weight" in their name to sum to 1.0
175
+ const formData = new FormData(form);
176
+ const weightFields = [];
177
+ let totalWeight = 0;
178
+
179
+ // Collect "weight" fields and calculate total weight
180
+ formData.forEach((value, key) => {
181
+ if (key.toLowerCase().includes("weight")) {
182
+ // Ensure valid number, default to 0
183
+ const numericValue = parseFloat(value) || 0;
184
+ weightFields.push({ key, value: numericValue });
185
+ totalWeight += numericValue;
186
+ }
187
+ });
188
+
189
+ // Normalize weights if totalWeight > 0 to avoid division by zero
190
+ if (totalWeight > 0) {
191
+ weightFields.forEach(field => {
192
+ const normalizedValue = field.value / totalWeight*100;
193
+ formData.set(field.key, normalizedValue);
194
+
195
+ // Update the input field in the form
196
+ const inputElement = form.querySelector(`[name="${field.key}"]`);
197
+ if (inputElement) {
198
+ // Limit decimals for readability
199
+ inputElement.value = normalizedValue.toFixed(0);
200
+ }
201
+ });
202
+ }
203
+
204
+ // Close all bridge tabs except the first one
205
+ initializedTabs.slice(1, initializedTabs.length).forEach(tab => {
206
+ if (tab.startsWith('c')) {
177
207
  console.log(tab);
178
208
  delCorridorTab(document.getElementById(`${tab}-tab`));
179
- }
180
- });
181
-
182
- // Create a URLSearchParams object from the form data
183
- // and fetch the data for the selected tab
184
- loadContent(tab, new FormData(form));
209
+ }
210
+ });
211
+
212
+ // Create a URLSearchParams object from the form data
213
+ // and fetch the data for the selected tab
214
+ loadContent(tab, formData);
185
215
  }
186
216
 
217
+
187
218
  // Event delegation: Listen for clicks on all nav links
188
219
  document.addEventListener('DOMContentLoaded', function () {
189
220
  initializedTabs.push('tab1');
@@ -197,4 +228,4 @@ document.addEventListener('DOMContentLoaded', function () {
197
228
  e.preventDefault(); handleClickedTab(tab);
198
229
  });
199
230
  });
200
- });
231
+ });
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: irie
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Infrastructure Resilience Engine
5
5
  Author-email: wd <5018-006+wd@users.noreply.github.com>
6
6
  Project-URL: Repository, https://github.com/STAIRLab/irie
@@ -60,11 +60,11 @@ Requires-Dist: dj-database-url==2.1.0
60
60
  <h4>PEER</h4>
61
61
  </div>
62
62
 
63
- ### External Dependencies
63
+ ### Powered By
64
64
 
65
- - [`quakeio`](https://pypi.org/project/quakeio)
66
65
  - [`opensees`](https://pypi.org/project/opensees)
66
+ - [`quakeio`](https://pypi.org/project/quakeio)
67
67
  - [`mdof`](https://pypi.org/project/mdof)
68
+ - [`sees`](https://pypi.org/project/sees)
68
69
  - [`sdof`](https://pypi.org/project/sdof)
69
70
 
70
- For developer notes, see [`help/README.md`](help/README.md).
@@ -422,7 +422,7 @@ irie/apps/templates/layouts/base-fullscreen.html,sha256=14X-eubwjujt4jGMJGvbYqaW
422
422
  irie/apps/templates/layouts/base.html,sha256=1fJ-YCAQMd-Lf83B4Lf1sMPkS6oGAzrmD5_h1xs-SKI,2313
423
423
  irie/apps/templates/layouts/json-form.html,sha256=cT6Pd2168Z3p8RODS7SulUC79LnuzSs0EVLVxkGOXAo,1333
424
424
  irie/apps/templates/networks/corridor_table.html,sha256=VijOUKq15D3zqru5nq-WZin59YIwb5FvOB1F8-K_MJQ,894
425
- irie/apps/templates/networks/networks.js,sha256=Dn0d1RwoNQ4e1EIFRpD3PR6_mA2WTSXYIGGk8LwR-rw,6341
425
+ irie/apps/templates/networks/networks.js,sha256=5uEshaGOxzwEbDo4nOVK2lCrNrYL_MO2d4vgqAIOT3U,7444
426
426
  irie/apps/templates/networks/styled_inputs.html,sha256=4IqtA4oQw6zAc2oypEYspIn_dS0syvVtZvkshhj1Tco,118
427
427
  irie/apps/templates/prediction/asset-predictors.html,sha256=Uu4QdwYe7xvtTG0NSMg9Fu5azajJBCiJTYyWnLBbhkk,3810
428
428
  irie/apps/templates/prediction/form-submission.html,sha256=IBAHLK2gr7kMgD-nemx-VVGpT4npEQwdsL5uGYiOhy8,5564
@@ -467,8 +467,8 @@ irie/init/data/networks/soga_corridors.json,sha256=AQOUaKGNWkQxQKLfqphE9Qb_-NRmj
467
467
  irie/init/management/commands/init_assets.py,sha256=LtptSA90Czy9vh3qfn6QqfLkR6o3Nw30QRQh4Poe8Qk,6426
468
468
  irie/init/management/commands/init_corridors.py,sha256=kvcY8V5blEdyUxVGxm3wtBhv9AddPz0wAUJFRufZVxo,1359
469
469
  irie/init/management/commands/init_predictors.py,sha256=5JwAb8vJUTCMVtwzolZLjxrN-O-UJxiiZg-ugTtbGoA,1993
470
- irie-0.0.3.dist-info/METADATA,sha256=DQxcetH-aS2EtDKQBApbQVzMJOx_36wQs8RMQ62J1Lk,2487
471
- irie-0.0.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
472
- irie-0.0.3.dist-info/entry_points.txt,sha256=A_3h9wPBGfxGQ78_MGa-nO6Z0foxOYeAnIE47jxEztg,44
473
- irie-0.0.3.dist-info/top_level.txt,sha256=zVCxi5E2nkISZPzKq8VEhWe_dGuPcefLYV1tYqQdwlY,5
474
- irie-0.0.3.dist-info/RECORD,,
470
+ irie-0.0.5.dist-info/METADATA,sha256=sOY6o2sNavhZF67yXCbStshIzBcr4LH3LL0sr1pPuL8,2457
471
+ irie-0.0.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
472
+ irie-0.0.5.dist-info/entry_points.txt,sha256=A_3h9wPBGfxGQ78_MGa-nO6Z0foxOYeAnIE47jxEztg,44
473
+ irie-0.0.5.dist-info/top_level.txt,sha256=zVCxi5E2nkISZPzKq8VEhWe_dGuPcefLYV1tYqQdwlY,5
474
+ irie-0.0.5.dist-info/RECORD,,
File without changes