@zac-apps/helium 1.3.0-beta.4 → 1.3.0-beta.5

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -4
  2. package/package.json +13 -13
package/dist/index.js CHANGED
@@ -1333,29 +1333,43 @@ function EstimateConsumption() {
1333
1333
 
1334
1334
  function EstimateSlope(_ref) {
1335
1335
  var data = _ref.data;
1336
+ _ref.spec;
1336
1337
  // define slope and intercept
1337
1338
 
1338
1339
  var slope = 0;
1339
1340
  var intercept = 0;
1340
1341
 
1341
- // find last time when spectrometer was filled - for this start from last point and go back until the first maximum is found
1342
+ // Define firstMax and firstMaxIndex
1342
1343
 
1343
1344
  var firstMax = Number(data[data.length - 1].level);
1344
1345
  var firstMaxIndex = data.length - 1;
1346
+
1347
+ // Check if the last time when the spectrometer was filled is more than 45 days ago
1348
+
1349
+ var lastMaxIndex = data.length - 1;
1350
+ var lastMax = Number(data[lastMaxIndex].level);
1345
1351
  for (var i = data.length - 2; i >= 0; i--) {
1346
1352
  var level = Number(data[i].level);
1347
1353
  if (level > firstMax) {
1348
- firstMax = level;
1349
- firstMaxIndex = i;
1354
+ lastMax = level;
1355
+ lastMaxIndex = i;
1350
1356
  }
1351
1357
 
1352
1358
  // stop if level decreases from maximum
1353
1359
 
1354
- if (level < firstMax) {
1360
+ if (level < lastMax) {
1355
1361
  break;
1356
1362
  }
1357
1363
  }
1358
1364
 
1365
+ // if the last maximum is less than 45 days ago, use the last maximum as the first maximum
1366
+ // otherwise, the initial firstMaxIndex is the last maximum index
1367
+
1368
+ if (lastMaxIndex >= data.length - 45) {
1369
+ firstMaxIndex = lastMaxIndex - 1;
1370
+ firstMax = Number(data[firstMaxIndex].level);
1371
+ }
1372
+
1359
1373
  // minimum level is the level at firstMaxIndex
1360
1374
 
1361
1375
  var minLevelIndex = firstMaxIndex - 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zac-apps/helium",
3
- "version": "1.3.0-beta.4",
3
+ "version": "1.3.0-beta.5",
4
4
  "scripts": {
5
5
  "rollup": "node_modules/rollup/dist/rollup.js",
6
6
  "dev": "next dev",
@@ -32,7 +32,7 @@
32
32
  "@mui/material": "^5.17.1",
33
33
  "@zac-apps/commons": "^1",
34
34
  "moment": "^2.30.1",
35
- "recharts": "^2.15.1",
35
+ "recharts": "^2.15.2",
36
36
  "regression": "^2.0.1",
37
37
  "use-immer": "^0.11.0"
38
38
  },
@@ -47,21 +47,21 @@
47
47
  "@semantic-release/git": "^10.0.1",
48
48
  "@semantic-release/gitlab": "^13.2.4",
49
49
  "@semantic-release/npm": "^12.0.1",
50
- "@storybook/addon-essentials": "^8.6.10",
51
- "@storybook/addon-interactions": "^8.6.10",
52
- "@storybook/addon-links": "^8.6.10",
53
- "@storybook/addon-onboarding": "^8.6.10",
54
- "@storybook/blocks": "^8.6.10",
55
- "@storybook/nextjs": "^8.6.10",
56
- "@storybook/react": "^8.6.10",
57
- "@storybook/test": "^8.6.10",
50
+ "@storybook/addon-essentials": "^8.6.12",
51
+ "@storybook/addon-interactions": "^8.6.12",
52
+ "@storybook/addon-links": "^8.6.12",
53
+ "@storybook/addon-onboarding": "^8.6.12",
54
+ "@storybook/blocks": "^8.6.12",
55
+ "@storybook/nextjs": "^8.6.12",
56
+ "@storybook/react": "^8.6.12",
57
+ "@storybook/test": "^8.6.12",
58
58
  "babel-loader": "^10.0.0",
59
59
  "eslint": "^9",
60
- "eslint-config-next": "15.2.4",
60
+ "eslint-config-next": "15.3.0",
61
61
  "eslint-plugin-storybook": "^0.12.0",
62
- "rollup": "^4.37.0",
62
+ "rollup": "^4.40.0",
63
63
  "semantic-release": "^24.2.3",
64
- "storybook": "^8.6.10"
64
+ "storybook": "^8.6.12"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "@zac-apps/commons": "^1",