Skip to content

Commit ec7bfd0

Browse files
wesmclaude
andcommitted
refactor: Rename 'recategorize' to 'edit_category' for consistency
Renamed throughout codebase for consistency with edit_merchant: - action_recategorize → action_edit_category - All method names, docstrings, and comments updated - All tests updated - Binding already changed to 'c' key in previous commit Consistent naming: edit_merchant and edit_category. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5f7d26c commit ec7bfd0

File tree

8 files changed

+32
-32
lines changed

8 files changed

+32
-32
lines changed

moneyflow/app.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class MoneyflowApp(App):
135135
Binding("right", "next_period", "→ Next", show=True),
136136
# Editing
137137
Binding("m", "edit_merchant", "Edit Merchant", show=False),
138-
Binding("c", "recategorize", "Recategorize", show=False),
138+
Binding("c", "edit_category", "Edit Category", show=False),
139139
Binding("d", "delete_transaction", "Delete", show=False),
140140
Binding("h", "toggle_hide_from_reports", "Hide/Unhide", show=False),
141141
Binding("i", "show_transaction_details", "Info", show=False),
@@ -1070,33 +1070,33 @@ async def _edit_merchant_detail(self) -> None:
10701070
if saved_cursor_row < table.row_count:
10711071
table.move_cursor(row=saved_cursor_row)
10721072

1073-
def action_recategorize(self) -> None:
1073+
def action_edit_category(self) -> None:
10741074
"""Change category for current selection (works in aggregate and detail views)."""
10751075

10761076
logger = get_logger(__name__)
10771077

10781078
if self.data_manager is None:
10791079
return
10801080

1081-
logger.debug(f"action_recategorize called, view_mode={self.state.view_mode}")
1081+
logger.debug(f"action_edit_category called, view_mode={self.state.view_mode}")
10821082

10831083
# Check if in aggregate view (MERCHANT, CATEGORY or GROUP) or detail view
10841084
if self.state.view_mode in [ViewMode.MERCHANT, ViewMode.CATEGORY, ViewMode.GROUP]:
1085-
logger.debug("Calling _bulk_recategorize_from_aggregate()")
1086-
# Aggregate view - recategorize all transactions for this merchant/category/group
1087-
self.run_worker(self._bulk_recategorize_from_aggregate(), exclusive=False)
1085+
logger.debug("Calling _bulk_edit_category_from_aggregate()")
1086+
# Aggregate view - edit_category all transactions for this merchant/category/group
1087+
self.run_worker(self._bulk_edit_category_from_aggregate(), exclusive=False)
10881088
else:
10891089
logger.debug(
1090-
f"Calling _recategorize() - view_mode {self.state.view_mode} not in aggregate views"
1090+
f"Calling _edit_category() - view_mode {self.state.view_mode} not in aggregate views"
10911091
)
1092-
# Detail view - recategorize selected transaction(s)
1093-
self.run_worker(self._recategorize(), exclusive=False)
1092+
# Detail view - edit_category selected transaction(s)
1093+
self.run_worker(self._edit_category(), exclusive=False)
10941094

1095-
async def _bulk_recategorize_from_aggregate(self) -> None:
1096-
"""Recategorize all transactions in selected merchant/category/group."""
1095+
async def _bulk_edit_category_from_aggregate(self) -> None:
1096+
"""Edit Category all transactions in selected merchant/category/group."""
10971097
logger = get_logger(__name__)
10981098

1099-
logger.debug(f"_bulk_recategorize_from_aggregate called, view_mode={self.state.view_mode}")
1099+
logger.debug(f"_bulk_edit_category_from_aggregate called, view_mode={self.state.view_mode}")
11001100

11011101
if self.state.current_data is None:
11021102
logger.warning("current_data is None, returning")
@@ -1151,12 +1151,12 @@ async def _bulk_recategorize_from_aggregate(self) -> None:
11511151
# Show success notification
11521152
new_cat_name = self.data_manager.categories.get(new_category_id, {}).get("name", "Unknown")
11531153
self.notify(
1154-
f"Queued {count} transactions from {field_name} to recategorize to {new_cat_name}. Press w to commit.",
1154+
f"Queued {count} transactions from {field_name} to edit_category to {new_cat_name}. Press w to commit.",
11551155
timeout=3,
11561156
)
11571157
self.refresh_view()
11581158

1159-
async def _recategorize(self) -> None:
1159+
async def _edit_category(self) -> None:
11601160
"""Show category selection and apply (for detail view)."""
11611161
if self.state.current_data is None:
11621162
return
@@ -1171,7 +1171,7 @@ async def _recategorize(self) -> None:
11711171

11721172
# Check if multi-select is active
11731173
if len(self.state.selected_ids) > 0:
1174-
# Multi-select recategorize
1174+
# Multi-select edit_category
11751175
num_selected = len(self.state.selected_ids)
11761176

11771177
# Show category selection (no transaction details for bulk)
@@ -1198,7 +1198,7 @@ async def _recategorize(self) -> None:
11981198
)
11991199
self.refresh_view()
12001200
else:
1201-
# Single transaction recategorize
1201+
# Single transaction edit_category
12021202
# Pass transaction details for context
12031203
txn_details = {
12041204
"date": row_data.get("date"),
@@ -1230,7 +1230,7 @@ async def _recategorize(self) -> None:
12301230
if saved_cursor_row < table.row_count:
12311231
table.move_cursor(row=saved_cursor_row)
12321232
else:
1233-
self.notify("Recategorize only works in transaction detail view", timeout=2)
1233+
self.notify("Edit Category only works in transaction detail view", timeout=2)
12341234

12351235
def action_toggle_hide_from_reports(self) -> None:
12361236
"""Toggle hide from reports flag for current transaction(s)."""

moneyflow/demo_data_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _create_categories(self) -> List[Dict]:
6060
Create comprehensive category list including all categories from CATEGORY_GROUPS.
6161
6262
This provides the full set of categories available when using Monarch Money,
63-
making the demo experience realistic. Users can recategorize transactions
63+
making the demo experience realistic. Users can edit_category transactions
6464
to any category they would have in the real app.
6565
6666
We start with hardcoded IDs for categories used in transaction generation
@@ -512,7 +512,7 @@ def _generate_amazon(self, month: int) -> List[Dict]:
512512
name = random.choice(amazon_names)
513513
amount = -random.uniform(15, 250)
514514

515-
# Sometimes miscategorized (should be recategorized in demo)
515+
# Sometimes miscategorized (should be edit_categoryd in demo)
516516
category = random.choice(
517517
[
518518
"cat_amazon",

moneyflow/keybindings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class KeyBinding:
4646
# Transaction Actions
4747
KeyBinding("i", "show_info", "Show transaction info/details", "Actions"),
4848
KeyBinding("m", "edit_merchant", "Edit merchant name", "Actions"),
49-
KeyBinding("r", "recategorize", "Change category", "Actions"),
49+
KeyBinding("r", "edit_category", "Change category", "Actions"),
5050
KeyBinding("h", "toggle_hide", "Toggle hide from reports", "Actions"),
5151
KeyBinding("d", "delete", "Delete transaction (with confirmation)", "Actions"),
5252
KeyBinding("space", "toggle_select", "Multi-select for bulk operations", "Actions"),

moneyflow/notification_helper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,19 @@ def category_changed() -> NotificationTuple:
113113
return ("Category changed. Press w to review and commit.", "information", 2)
114114

115115
@staticmethod
116-
def bulk_recategorize_queued(count: int, old_cat: str, new_cat: str) -> NotificationTuple:
116+
def bulk_edit_category_queued(count: int, old_cat: str, new_cat: str) -> NotificationTuple:
117117
"""Bulk recategorization queued."""
118118
return (
119-
f"Queued {count} transactions to recategorize: {old_cat}{new_cat}. Press w to commit.",
119+
f"Queued {count} transactions to edit_category: {old_cat}{new_cat}. Press w to commit.",
120120
"information",
121121
3,
122122
)
123123

124124
@staticmethod
125-
def bulk_recategorize_from_group(count: int, group: str, new_cat: str) -> NotificationTuple:
125+
def bulk_edit_category_from_group(count: int, group: str, new_cat: str) -> NotificationTuple:
126126
"""Bulk recategorization from group queued."""
127127
return (
128-
f"Queued {count} transactions from {group} to recategorize to {new_cat}. Press w to commit.",
128+
f"Queued {count} transactions from {group} to edit_category to {new_cat}. Press w to commit.",
129129
"information",
130130
3,
131131
)

tests/test_app_controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ async def test_merchant_view_hints(self, controller, mock_view):
291291
assert "bulk" in hints.lower()
292292

293293
async def test_category_view_hints(self, controller, mock_view):
294-
"""Category view should show recategorize hint."""
294+
"""Category view should show edit_category hint."""
295295
controller.state.view_mode = ViewMode.CATEGORY
296296

297297
controller.refresh_view()

tests/test_commit_orchestrator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ def mock_apply_groups(df): return df
476476
assert updated.filter(pl.col("id") == "txn3")["merchant"][0] == "Starbucks" # Unchanged
477477
assert updated.filter(pl.col("id") == "txn4")["merchant"][0] == "Amazon"
478478

479-
def test_recategorize_with_group_update(self):
479+
def test_edit_category_with_group_update(self):
480480
"""Should handle recategorization with group updates."""
481481
df = pl.DataFrame({
482482
"id": ["txn1"],
@@ -535,7 +535,7 @@ def mock_apply_groups(df): return df
535535
assert updated.filter(pl.col("id") == "txn3")["hideFromReports"][0] is False
536536

537537
def test_complex_workflow_sequence(self):
538-
"""Test realistic workflow: rename merchant, recategorize, hide."""
538+
"""Test realistic workflow: rename merchant, edit_category, hide."""
539539
df = pl.DataFrame({
540540
"id": ["txn1"],
541541
"merchant": ["WHOLE FOODS MKT #123"],
@@ -552,7 +552,7 @@ def test_complex_workflow_sequence(self):
552552
edits = [
553553
# Step 1: Clean up merchant name
554554
TransactionEdit("txn1", "merchant", "WHOLE FOODS MKT #123", "Whole Foods", datetime.now()),
555-
# Step 2: Recategorize to Groceries
555+
# Step 2: Edit Category to Groceries
556556
TransactionEdit("txn1", "category", "cat_misc", "cat_groceries", datetime.now()),
557557
]
558558

tests/test_editing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ async def test_edit_merchant_detail_view_with_multiselect(self, loaded_data_mana
160160
updated = mock_mm.get_transaction_by_id(txn_id)
161161
assert updated["merchant"]["name"] == new_merchant
162162

163-
async def test_recategorize_transaction(self, loaded_data_manager, mock_mm):
163+
async def test_edit_category_transaction(self, loaded_data_manager, mock_mm):
164164
"""Test changing category for a transaction."""
165165
dm, df, categories, _ = loaded_data_manager
166166

@@ -555,7 +555,7 @@ async def test_multiselect_with_some_invalid_transaction_ids(self, data_manager,
555555
txn_2 = mock_mm.get_transaction_by_id("txn_2")
556556
assert txn_2["merchant"]["name"] == "New Name"
557557

558-
async def test_recategorize_with_invalid_category_id(self, loaded_data_manager, mock_mm):
558+
async def test_edit_category_with_invalid_category_id(self, loaded_data_manager, mock_mm):
559559
"""Test that recategorizing with invalid category ID fails gracefully."""
560560
dm, df, _, _ = loaded_data_manager
561561

tests/test_notification_helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ def test_category_changed(self):
125125
assert "Category changed" in msg
126126
assert "Press w" in msg
127127

128-
def test_bulk_recategorize_queued(self):
129-
msg, severity, timeout = NotificationHelper.bulk_recategorize_queued(
128+
def test_bulk_edit_category_queued(self):
129+
msg, severity, timeout = NotificationHelper.bulk_edit_category_queued(
130130
50, "Food & Dining", "Groceries"
131131
)
132132
assert "50 transactions" in msg

0 commit comments

Comments
 (0)