refactor: remove code redundancy and improve maintainability

- Extract duplicate view logic into reusable helper functions in views.py
- Move circular import from module level to method scope in models.py
- Create constants.py for centralized hardcoded values (Nepali words, placeholders)
- Simplify number_to_nepali_words function from 157 to 42 lines
- Refactor normalize_address with extracted helper functions
- Add lang_utils.py for consistent language parameter handling
- Reduce JavaScript duplication in address-chaining.js with helper functions
- Remove ~160+ lines of redundant code while preserving all logic
- All 79 tests passing, ruff linting passes
This commit is contained in:
sankalp committed 2026-02-05 20:49:26 +05:45
1 parent 74936ddabd
commit 718cff2951
8 files changed
+509 -309

No files matched your search

+18
View File
@@ -1,3 +1,21 @@
## V.2.1.0 — 2027-02-05
### ✨ Features
- upgrade nepali package to 1.2.0 and remove hardcoded Koshi Province mapping
### ♻️ Refactoring
- remove code redundancy and improve maintainability
- extract duplicate view logic into reusable helper functions in views.py
- create constants.py for centralized hardcoded values (Nepali words, placeholders)
- simplify number_to_nepali_words function from 157 to 42 lines
- refactor normalize_address with extracted helper functions
- add lang_utils.py for consistent language parameter handling
- reduce JavaScript duplication in address-chaining.js with helper functions
- move circular import from module level to method scope in models.py
- remove ~160+ lines of redundant code while preserving all logic
## V.2.0.0 — 2026-01-31
### ✨ Features