mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 11:06:40 +07:00
feat: auto-capitalize the first letter of transaction descriptions
Transactions/recurring templates entered with mixed casing ("траты на
продукты") are now capitalized on create/update via a Pydantic validator,
so the fix applies to every client, not just the web UI. Adds a one-off
backfill script for existing rows.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
12
backend/app/core/text.py
Normal file
12
backend/app/core/text.py
Normal file
@@ -0,0 +1,12 @@
|
||||
"""Shared text-formatting helpers."""
|
||||
|
||||
|
||||
def capitalize_first_letter(value: str) -> str:
|
||||
"""Uppercase the first character, leaving the rest of the string untouched.
|
||||
|
||||
Unlike str.capitalize()/str.title(), this never lowercases the rest of the
|
||||
string — "iPhone 15" stays "iPhone 15", not "Iphone 15".
|
||||
"""
|
||||
if not value:
|
||||
return value
|
||||
return value[0].upper() + value[1:]
|
||||
Reference in New Issue
Block a user