Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Commit

Permalink
Fix calculating future budgets
Browse files Browse the repository at this point in the history
  • Loading branch information
rix1337 committed Jul 30, 2023
1 parent c039162 commit 8bb1071
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 8 additions & 2 deletions .github/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@
### Changelog BudgeTeer:

#### v.0.1.2
- Fehlerbehebung bei Aktivierung von Basic Auth
- Die Gültigkeit von künftigen Budgets wird bei deren Berechnung beachtet
- ToDo
- Book budgets per month (NOT GLOBALLY)
- Add Weekly/Yearly budget types
- Mark budgets booked per month (NOT GLOBALLY)
- Add Yearly budget type (select month only for validity)
- Add Weekly budget type
- calculate weeks of month automatically
- instead of done check do done +/- counter button
- Allow displaying future remaining budget in head

#### v.0.1.1
- Fehlerkorrektur beim Hinzufügen neuer Konten, Transaktionen und Budgets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function prettifyAmount(amount) {
function calculateCategoryTotal(i) {
let total = 0
for (let j = 0; j < store.state.data.budgets[i].entries.length; j++) {
if (showEntry(store.state.data.budgets[i].entries[j])) {
if (calculateEntry(store.state.data.budgets[i].entries[j])) {
let amount = parseFloat(store.state.data.budgets[i].entries[j].amount)
if (!isNaN(amount)) {
total += amount
Expand All @@ -41,6 +41,14 @@ function updateDisplayMonth(index) {
display_month.value = new Date(indexed_date).toISOString().slice(0, 7)
}
function calculateEntry(entry) {
if (displayMonthIsCurrentMonth()) {
return !entry.booked && checkEntryInDisplayMonth(entry)
} else {
return checkEntryInDisplayMonth(entry)
}
}
function showEntry(entry) {
if (store.state.locked && displayMonthIsCurrentMonth()) {
return !entry.booked && checkEntryInDisplayMonth(entry)
Expand Down

0 comments on commit 8bb1071

Please sign in to comment.