about summary refs log tree commit diff stats
path: root/src/bestiary.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/bestiary.js')
-rw-r--r--src/bestiary.js15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/bestiary.js b/src/bestiary.js
index 33779d3..0598abb 100644
--- a/src/bestiary.js
+++ b/src/bestiary.js
@@ -4,12 +4,12 @@ import isBetween from "dayjs/plugin/isBetween";
 day.extend(isBetween);
 
 export function getMatches(forecast, level) {
-  console.log(level);
   let res = [];
   pagosB.forEach((b) => {
     if (b.level >= level && b.level - 2 < level) {
       res.push({
         name: b.name,
+        level: b.level,
         elem: b.elem,
         special: b.type > 0,
         mutating: b.type === 1,
@@ -19,6 +19,7 @@ export function getMatches(forecast, level) {
     }
   });
   console.log(res);
+  return res;
 }
 
 function getEzTime() {
@@ -29,19 +30,15 @@ function findForecastMatch(forecast, conditions) {
   const time = getEzTime();
   const dn = time.isBetween(time.hour(8), time.hour(18)) ? "day" : "night";
   return {
-    isUp: forecastMatches(forecast, conditions[dn], 0).length > 0,
-    weathers: forecastMatches(forecast, conditions[dn], 0),
+    isUp: forecastMatches(forecast, conditions[dn], 0),
+    weathers: conditions[dn],
     futureUptime: [1, 2, 3, 4].map((i) => {
-      const match = forecastMatches(forecast, conditions[dn], i);
-      return {
-        isUp: match.length > 0,
-        weathers: match,
-      };
+      return forecastMatches(forecast, conditions[dn], i);
     }),
   };
 }
 
 function forecastMatches(forecast, condition, index) {
   const currWeather = forecast[index].currWeather;
-  return condition.filter((c) => c === currWeather);
+  return condition.some((c) => c === currWeather);
 }