@lynn123411/dsh-a6api 1.4.1 → 1.5.0

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.
package/lib/index.js CHANGED
@@ -810,11 +810,19 @@ async function fetchPriceFluctuation(userId, accessToken) {
810
810
  let unseen = unseenPick.value;
811
811
  const total = arr.length;
812
812
  if (!pendingPick.present && arr.length > 0) {
813
- const counted = arr.filter((n) => {
814
- const s = String(n.state || n.status || "").toLowerCase();
815
- return s === "open" || s === "pending" || n.pending === true;
816
- }).length;
817
- const hasState = arr.some((n) => n.state !== void 0 || n.status !== void 0);
813
+ const isPendingNotice = (n) => {
814
+ if (n?.pending === true) return true;
815
+ const rels = Array.isArray(n?.relations) ? n.relations : [];
816
+ if (rels.length > 0) {
817
+ return rels.some((r) => String(r?.state ?? "").toLowerCase() === "open");
818
+ }
819
+ const s = String(n?.state ?? n?.status ?? "").toLowerCase();
820
+ return s === "open" || s === "pending" || s === "effective";
821
+ };
822
+ const counted = arr.filter(isPendingNotice).length;
823
+ const hasState = arr.some(
824
+ (n) => n.state !== void 0 || n.status !== void 0 || Array.isArray(n.relations) && n.relations.length > 0
825
+ );
818
826
  if (hasState) pending = counted;
819
827
  }
820
828
  if (!unseenPick.present && arr.length > 0) {