Compare commits
1
Commits
dev
..
52e755f05a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52e755f05a |
No files matched your search
+5
-16
@@ -118,23 +118,12 @@ export function periodOf(value: string, view: ViewRange): Range {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const UNITS: ViewRange[] = ["1M", "3M", "6M", "1Y"];
|
|
||||||
|
|
||||||
function unitOf(range: Range, view: ViewRange): ViewRange | null {
|
|
||||||
const units = isDynamic(view) ? UNITS : [view, ...UNITS];
|
|
||||||
return (
|
|
||||||
units.find((unit) => {
|
|
||||||
const aligned = periodOf(range.start, unit);
|
|
||||||
return aligned.start === range.start && range.end <= aligned.end;
|
|
||||||
}) ?? null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function shiftPeriod(range: Range, view: ViewRange, dir: 1 | -1): Range {
|
export function shiftPeriod(range: Range, view: ViewRange, dir: 1 | -1): Range {
|
||||||
const unit = unitOf(range, view);
|
const fixed = isDynamic(view) ? "1M" : view;
|
||||||
if (unit) {
|
const aligned = periodOf(range.start, fixed);
|
||||||
const anchor = dir === 1 ? periodOf(range.start, unit).end : range.start;
|
if (aligned.start === range.start && aligned.end === range.end) {
|
||||||
return periodOf(addDays(anchor, dir), unit);
|
const anchor = dir === 1 ? addDays(range.end, 1) : addDays(range.start, -1);
|
||||||
|
return periodOf(anchor, fixed);
|
||||||
}
|
}
|
||||||
const days = daysBetween(range.start, range.end) + 1;
|
const days = daysBetween(range.start, range.end) + 1;
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -28,12 +28,10 @@ export const runwayQueries = {
|
|||||||
bills: (start: string, end: string) => ({
|
bills: (start: string, end: string) => ({
|
||||||
queryFn: () => all<Bill>("/v1/bills", { end, start }),
|
queryFn: () => all<Bill>("/v1/bills", { end, start }),
|
||||||
queryKey: ["subscriptions", "runway", start, end],
|
queryKey: ["subscriptions", "runway", start, end],
|
||||||
refetchOnWindowFocus: true,
|
|
||||||
}),
|
}),
|
||||||
paid: () => ({
|
paid: () => ({
|
||||||
queryFn: async () => toPayments(await search("has_any_bill:true")),
|
queryFn: async () => toPayments(await search("has_any_bill:true")),
|
||||||
queryKey: ["subscriptions", "payments"],
|
queryKey: ["subscriptions", "payments"],
|
||||||
refetchOnWindowFocus: true,
|
|
||||||
}),
|
}),
|
||||||
unlinked: (day: string) => {
|
unlinked: (day: string) => {
|
||||||
const after = addDays(day, -UNLINKED_DAYS);
|
const after = addDays(day, -UNLINKED_DAYS);
|
||||||
|
|||||||
@@ -208,7 +208,11 @@ function occurrences(bill: Bill, day: string) {
|
|||||||
return (bill.pay_dates ?? [])
|
return (bill.pay_dates ?? [])
|
||||||
.map((raw) => raw.slice(0, 10))
|
.map((raw) => raw.slice(0, 10))
|
||||||
.filter((date) => !end || date <= end)
|
.filter((date) => !end || date <= end)
|
||||||
.filter((date) => !paid.some((p) => Math.abs(daysBetween(p, date)) < early))
|
.filter(
|
||||||
|
(date) =>
|
||||||
|
date < day ||
|
||||||
|
!paid.some((p) => p <= date && daysBetween(p, date) < early)
|
||||||
|
)
|
||||||
.map((date) => ({ date: date < day ? day : date, overdue: date < day }));
|
.map((date) => ({ date: date < day ? day : date, overdue: date < day }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -491,9 +491,7 @@
|
|||||||
{@const ends = bill.end_date?.slice(0, 10)}
|
{@const ends = bill.end_date?.slice(0, 10)}
|
||||||
{@const last = lastOf(item)}
|
{@const last = lastOf(item)}
|
||||||
{@const who = payer(item)}
|
{@const who = payer(item)}
|
||||||
{@const stale = paid.isSuccess
|
{@const stale = staleSince(bill, last, day)}
|
||||||
? staleSince(bill, last, day)
|
|
||||||
: null}
|
|
||||||
{@const extra = found.get(item.id) ?? []}
|
{@const extra = found.get(item.id) ?? []}
|
||||||
{@const armedHere = arm.key?.endsWith(`:${item.id}`)}
|
{@const armedHere = arm.key?.endsWith(`:${item.id}`)}
|
||||||
<tr
|
<tr
|
||||||
@@ -569,7 +567,7 @@
|
|||||||
billIds={manualCards.picking.ids}
|
billIds={manualCards.picking.ids}
|
||||||
cards={cardList}
|
cards={cardList}
|
||||||
/>
|
/>
|
||||||
{:else if bill.active && paid.isSuccess}
|
{:else if bill.active}
|
||||||
{#if who.card}
|
{#if who.card}
|
||||||
<span class="text-cladd-fg-soft"
|
<span class="text-cladd-fg-soft"
|
||||||
>{who.card.name}</span
|
>{who.card.name}</span
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ x-firefly-env: &firefly-env
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
v1:
|
v1:
|
||||||
image: fireflyiii/core:version-6.6.6
|
image: fireflyiii/core:version-6.6.6@sha256:ae69fdd95cdef9038cd7a460a5aec731f14813973e4f096511d5a4ea9ff0e972
|
||||||
environment:
|
environment:
|
||||||
<<: *firefly-env
|
<<: *firefly-env
|
||||||
APP_KEY: ffuistandv1ffuistandv1ffuistand1
|
APP_KEY: ffuistandv1ffuistandv1ffuistand1
|
||||||
@@ -26,7 +26,7 @@ services:
|
|||||||
- "127.0.0.1:${FFUI_V1_PORT:-30072}:8080"
|
- "127.0.0.1:${FFUI_V1_PORT:-30072}:8080"
|
||||||
|
|
||||||
v3:
|
v3:
|
||||||
image: fireflyiii/core:latest
|
image: fireflyiii/core:latest@sha256:a2b53539338d1cd04d341b229c3806cb178cf64c72459060e3ed34bec4167bd8
|
||||||
environment:
|
environment:
|
||||||
<<: *firefly-env
|
<<: *firefly-env
|
||||||
APP_KEY: ffuistandv3ffuistandv3ffuistand3
|
APP_KEY: ffuistandv3ffuistandv3ffuistand3
|
||||||
|
|||||||
Reference in new issue
Block a user