Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
EnhancedJax committed Jan 11, 2025
2 parents ce151df + c26da64 commit f2e2130
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.2.6

- Bumped textual to 1.0.0
- Fixed: Account field not required when creating paid split
- Fixed: Beginning balance 0 will pass validation but does not pass non-null constraint

## 0.2.5

- Fixed: Typo in update command
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "Bagels"
version = "0.2.5"
version = "0.2.6"
authors = [
{ name = "Jax", email = "enhancedjax@gmail.com" }
]
Expand Down Expand Up @@ -40,7 +40,7 @@ dependencies = [
"packaging==23.0",
"rich==13.9.3",
"sqlalchemy==2.0.36",
"textual==0.86.1",
"textual==1.0.0",
"tomli>=2.0.2",
"typing-extensions==4.12.2",
"uc-micro-py==1.0.3",
Expand Down
2 changes: 1 addition & 1 deletion src/bagels/components/autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def reposition(
line_below_cursor = y + 1 + scroll_target_adjust_y

cursor_screen_position = x + (
input_cursor_position - self.input_widget.view_position
input_cursor_position - self.input_widget.cursor_position
)
self.styles.margin = (
line_below_cursor,
Expand Down
3 changes: 1 addition & 2 deletions src/bagels/components/percentage_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ class PercentageBar(Static):
.empty-bar {
hatch: right $panel-lighten-2;
align-horizontal: center;
Label {
dock: left;
align-horizontal: center;
padding: 0 1 0 1;
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/bagels/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,7 @@ def write_state(key: str, value: Any) -> None:

with open(config_file(), "w") as f:
yaml.dump(config, f, default_flow_style=False)

# update the global config object
global CONFIG
setattr(CONFIG.state, key, value)
2 changes: 2 additions & 0 deletions src/bagels/forms/record_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ def get_split_form(
field.default_value = isPaid
elif fieldKey == "accountId" and isPaid:
field.type = "autocomplete"
field.is_required = True
elif fieldKey == "paidDate" and isPaid:
field.type = "dateAutoDay"
field.is_required = True
field.default_value = (
defaultPaidDate.strftime("%d %m %y") if defaultPaidDate else ""
)
Expand Down
3 changes: 1 addition & 2 deletions src/bagels/index.tcss
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ Button {
.month-selector {
height: 2;
layout: horizontal;
align: center middle;

Button {
width: auto;
Expand All @@ -478,8 +479,6 @@ Button {
color: $primary-background-lighten-3;
}
.current-filter-label {
dock: left;
align: center middle;
}
#next-month {
dock: right;
Expand Down
8 changes: 4 additions & 4 deletions src/bagels/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ def _validate_autocomplete(
value: str, held_value: str, field: FormField
) -> Tuple[bool, str | None]:
"""Validate an autocomplete field and return (is_valid, error_message)"""
if field.key == "label":
print(value, held_value, field)
if not value and not held_value:
if field.is_required:
return False, "Must be selected"
Expand Down Expand Up @@ -114,17 +112,19 @@ def validateForm(

error = None

# print(f"Validating {fieldKey} with value {fieldValue}")

match field.type:
case "integer":
is_valid, error, num_val = _validate_number(fieldValue, field)
if is_valid and fieldValue and num_val:
if is_valid and fieldValue is not None and num_val is not None:
result[fieldKey] = num_val

case "number":
is_valid, error, num_val = _validate_number(
fieldValue, field, is_float=True
)
if is_valid and fieldValue and num_val:
if is_valid and fieldValue is not None and num_val is not None:
result[fieldKey] = num_val

case "date":
Expand Down
10 changes: 5 additions & 5 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f2e2130

Please sign in to comment.