Skip to content

Commit 58f11fc

Browse files
authored
Merge pull request #53 from Tanq16/bundlefixes
Deploy New Version
2 parents ade458c + e0ead97 commit 58f11fc

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ If setting up for the first time, an environment variable can be used for ease.
202202
CURRENCY=eur ./expenseowl
203203
```
204204

205+
> [!NOTE]
206+
> Expense Owl primarily supports using positive values for all expenses by default. For better imports and higher control, ExpenseOwl also allows for negative values (see https://github.com/Tanq16/ExpenseOwl/pull/39). As such, positive expenses indicate money spent, while negative expenses indicate money gained, i.e., a return or reimbursment.
207+
> Various software deal with positive and negative expenses differently. This project aims to provide freedom in operation, as a result of which a future refactor will allow for a choice for accurate external imports.
208+
205209
ExpenseOwl also supports custom categories. A default set is pre-loaded in the config for ease of use and can be easily changed within the UI.
206210

207211
Like currency, if setting up for the first time, categories can be specified in an environment variable like so:

internal/api/import-export.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func (h *Handler) ImportCSV(w http.ResponseWriter, r *http.Request) {
163163
}
164164
// Handle amount (skipping regex since parsing as float)
165165
amount, err := strconv.ParseFloat(strings.TrimSpace(record[amountIdx]), 64)
166-
if err != nil || amount <= 0 {
166+
if err != nil {
167167
log.Printf("Warning: Skipping row %d due to invalid amount: %s\n", i, record[amountIdx])
168168
continue
169169
}

internal/config/config.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ func (e *Expense) Validate() error {
8686
if e.Category == "" {
8787
return errors.New("category is required")
8888
}
89-
if e.Amount <= 0 {
90-
return errors.New("amount must be greater than 0")
91-
}
9289
return nil
9390
}
9491

internal/web/templates/index.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686

8787
<div class="form-group">
8888
<label for="amount">Amount</label>
89-
<input type="number" id="amount" step="0.01" min="0.01" required>
89+
<input type="number" id="amount" step="0.01" required>
9090
</div>
9191

9292
<div class="form-group">
@@ -354,9 +354,6 @@
354354
// Update month display and navigation buttons
355355
function updateMonthDisplay() {
356356
document.getElementById('currentMonth').textContent = formatMonth(currentDate);
357-
const now = new Date();
358-
const isCurrentMonth = currentDate.getMonth() === now.getMonth() && currentDate.getFullYear() === now.getFullYear();
359-
document.getElementById('nextMonth').disabled = isCurrentMonth;
360357
}
361358
// Get start and end of month
362359
function getMonthBounds(date) {
@@ -490,6 +487,13 @@
490487
}
491488
});
492489
document.addEventListener('DOMContentLoaded', initialize);
490+
491+
// event listener to remove the - from the name input when the user clicks on the input
492+
document.getElementById('name').addEventListener('click', (e) => {
493+
if (e.target.value === '-') {
494+
e.target.value = '';
495+
}
496+
});
493497
</script>
494498
</body>
495499
</html>

internal/web/templates/table.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
<div class="form-group">
5151
<label for="amount">Amount</label>
52-
<input type="number" id="amount" step="0.01" min="0.01" required>
52+
<input type="number" id="amount" step="0.01" required>
5353
</div>
5454

5555
<div class="form-group">
@@ -137,9 +137,6 @@ <h3>Delete Expense</h3>
137137

138138
function updateMonthDisplay() {
139139
document.getElementById('currentMonth').textContent = formatMonth(currentDate);
140-
const now = new Date();
141-
const isCurrentMonth = currentDate.getMonth() === now.getMonth() && currentDate.getFullYear() === now.getFullYear();
142-
document.getElementById('nextMonth').disabled = isCurrentMonth;
143140
}
144141
function getMonthBounds(date) {
145142
const localDate = new Date(date);
@@ -383,6 +380,13 @@ <h3>Delete Expense</h3>
383380
}
384381
});
385382
document.addEventListener('DOMContentLoaded', initialize);
383+
384+
// event listener to remove the - from the name input when the user clicks on the input
385+
document.getElementById('name').addEventListener('click', (e) => {
386+
if (e.target.value === '-') {
387+
e.target.value = '';
388+
}
389+
});
386390
</script>
387391
</body>
388392
</html>

0 commit comments

Comments
 (0)