Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ make templates classy and replace 🍝 code #3754

Merged
merged 36 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f0d10db
by check
youngcw Oct 25, 2024
5ee7257
minor changes and TS class migration
youngcw Oct 30, 2024
b8d19f2
good starting point
youngcw Oct 30, 2024
5a28390
very basic testing
youngcw Oct 30, 2024
9b1aef1
Merge branch 'youngcw/classy-templates' of github.com:actualbudget/ac…
youngcw Oct 30, 2024
8c57d53
fix
youngcw Oct 30, 2024
1821c13
basic overwrite of simple templates working
youngcw Oct 30, 2024
32d471c
mostly working. By and schedule don't work
youngcw Oct 30, 2024
7bb4dfa
Merge branch 'youngcw/classy-templates' of github.com:actualbudget/ac…
youngcw Oct 31, 2024
9553e7b
some cleanup, better async
youngcw Nov 1, 2024
2f929eb
add notifications
youngcw Nov 2, 2024
aa48f2a
add daily weekly limits
youngcw Nov 2, 2024
31edc84
by is working I think
youngcw Nov 2, 2024
b1e78b4
mostly working
youngcw Nov 2, 2024
a0fdfd4
some fixes, make faster
youngcw Nov 2, 2024
bc3000c
lint, note
youngcw Nov 2, 2024
87a7132
note
youngcw Nov 2, 2024
4f346bf
cleanup old stuff
youngcw Nov 2, 2024
d8fd63b
fix paths
youngcw Nov 2, 2024
8a76b2f
test fixes
youngcw Nov 2, 2024
10c891e
fix test
youngcw Nov 2, 2024
1bda7d2
fix note
youngcw Nov 2, 2024
c497c26
rabbit, and fix long goal
youngcw Nov 2, 2024
e5c7940
lint
youngcw Nov 2, 2024
04922ca
some fixes
youngcw Nov 3, 2024
f871248
more typing
youngcw Nov 3, 2024
1700cc8
fix save error
youngcw Nov 3, 2024
b0ec0d6
last bunny fixes
youngcw Nov 3, 2024
018a655
fix save, trim schedule names
youngcw Nov 3, 2024
e8fb817
lint
youngcw Nov 3, 2024
d688cc6
Merge branch 'master' into youngcw/classy-templates
youngcw Nov 3, 2024
c55a446
minor fixes
youngcw Nov 4, 2024
d9789cd
Merge branch 'youngcw/classy-templates' of github.com:actualbudget/ac…
youngcw Nov 4, 2024
a0c4326
fix that broken merge
youngcw Nov 4, 2024
e149f67
last fixes
youngcw Nov 4, 2024
875adba
lint
youngcw Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
540 changes: 540 additions & 0 deletions packages/loot-core/src/server/budget/categoryTemplate.ts

Large diffs are not rendered by default.

37 changes: 21 additions & 16 deletions packages/loot-core/src/server/budget/goal-template.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,37 @@ expr
...(repeat ? repeat[3] : {}),
from,
priority: template.priority, directive: template.directive
} }
}}
/ template: template _ monthly: amount limit: limit?
{ return { type: 'simple', monthly, limit, priority: template.priority, directive: template.directive } }
{ return { type: 'simple', monthly, limit, priority: template.priority, directive: template.directive }}
/ template: template _ limit: limit
{ return { type: 'simple', limit , priority: template.priority, directive: template.directive } }
{ return { type: 'simple', monthly: null, limit, priority: template.priority, directive: template.directive }}
/ template: template _ schedule _ full:full? name: name
{ return { type: 'schedule', name, priority: template.priority, directive: template.directive, full } }
{ return { type: 'schedule', name, priority: template.priority, directive: template.directive, full }}
/ template: template _ remainder: remainder limit: limit?
{ return { type: 'remainder', priority: null, directive: template.directive, weight: remainder, limit } }
{ return { type: 'remainder', priority: null, directive: template.directive, weight: remainder, limit }}
/ template: template _ 'average'i _ amount: positive _ 'months'i?
{ return { type: 'average', amount: +amount, priority: template.priority, directive: template.directive }}
{ return { type: 'average', numMonths: +amount, priority: template.priority, directive: template.directive }}
/ template: template _ 'copy from'i _ lookBack: positive _ 'months ago'i limit:limit?
{ return { type: 'copy', priority: template.priority, directive: template.directive, lookBack: +lookBack, limit }}
/ goal: goal amount: amount { return {type: 'simple', amount: amount, priority: null, directive: 'goal' }}
/ goal: goal amount: amount { return {type: 'simple', amount: amount, priority: null, directive: goal }}


repeat 'repeat interval'
= 'month'i { return { annual: false } }
/ months: positive _ 'months'i { return { annual: false, repeat: +months } }
/ 'year'i { return { annual: true } }
/ years: positive _ 'years'i { return { annual: true, repeat: +years } }
= 'month'i { return { annual: false }}
/ months: positive _ 'months'i { return { annual: false, repeat: +months }}
/ 'year'i { return { annual: true }}
/ years: positive _ 'years'i { return { annual: true, repeat: +years }}

limit = _? upTo _ amount: amount _ 'hold'i { return {amount: amount, hold: true } }
/ _? upTo _ amount: amount { return {amount: amount, hold: false } }
limit = _? upTo _ amount: amount _ 'per week starting'i _ start:date _? hold:hold?
{ return {amount: amount, hold: hold, period: 'weekly', start: start }}
/ _? upTo _ amount: amount _ 'per day'i _? hold: hold?
{ return {amount: amount, hold: hold, period: 'daily', start:null }}
/ _? upTo _ amount: amount _? hold: hold?
{ return {amount: amount, hold: hold, period: 'monthly', start:null }}
youngcw marked this conversation as resolved.
Show resolved Hide resolved

percentOf = percent:percent _ of _ 'previous'i _ { return { percent: percent, prev: true} }
/ percent:percent _ of _ { return { percent: percent, prev: false} }
percentOf = percent:percent _ of _ 'previous'i _ { return { percent: percent, prev: true}}
/ percent:percent _ of _ { return { percent: percent, prev: false}}

weekCount
= week { return null }
Expand All @@ -54,12 +58,13 @@ of = 'of'i
repeatEvery = 'repeat'i _ 'every'i
starting = 'starting'i
upTo = 'up'i _ 'to'i
hold = 'hold'i {return true}
schedule = 'schedule'i
full = 'full'i _ {return true}
priority = '-'i number: number {return number}
remainder = 'remainder'i _? weight: positive? { return +weight || 1 }
template = '#template' priority: priority? {return {priority: +priority, directive: 'template'}}
goal = '#goal'
goal = '#goal'i { return 'goal'}

_ 'space' = ' '+
d 'digit' = [0-9]
Expand Down
89 changes: 0 additions & 89 deletions packages/loot-core/src/server/budget/goals/goalsAverage.test.ts

This file was deleted.

30 changes: 0 additions & 30 deletions packages/loot-core/src/server/budget/goals/goalsAverage.ts

This file was deleted.

134 changes: 0 additions & 134 deletions packages/loot-core/src/server/budget/goals/goalsBy.test.ts

This file was deleted.

49 changes: 0 additions & 49 deletions packages/loot-core/src/server/budget/goals/goalsBy.ts

This file was deleted.

Loading
Loading