refactor: extract shared utilities for duplicated code patterns - #3
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
refactor: extract shared utilities for duplicated code patterns#3devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- models: hoist duplicated category_ru/emoji computed fields into a shared CategoryLabeled base (Box, Order inherit) - db: add _partner_fields, _order_row_by_code, _order_row_by_id, _box_row_by_id helpers to remove repeated SQL/row-mapping - frontend: add getSafe() to collapse repeated try/catch GET calls Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
wpalish
pushed a commit
that referenced
this pull request
Jul 16, 2026
…арточка); +контраст футера По UX-ревью: - #1 localStorage-нотис был плавающей центр-карточкой (читалось как «глюк» поверх секций) → тонкая полоса во всю ширину, приклеена к низу (над bottom-nav на мобиле, к краю на десктопе). Показ один раз (флаг ym_cookies уже был). - #6 контраст копирайта/FAQ-текста в футере поднят (.6→.78, .7→.82 opacity) — запас под WCAG AA. Уже было в коде: #4 срочность («🔥 осталось N» + окно выдачи), #7 соцсети на светлом --on-ink (не бледные). Требуют ассетов (отдельно): #2 превью карты, #3 логотипы партнёров/отзывы, #5 лого-марка, #8 PWA-бейджи. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors three duplicated patterns into shared utilities. Behavior is unchanged — all 7 existing tests pass and API serialization (
category_ru,emoji,discount) is verified identical.1.
models.py— duplicated computed fields.BoxandOrdereach defined byte-identicalcategory_ru/emojicomputed properties. Hoisted into a shared base both now inherit:2.
db.py— repeated SQL / row-mapping. Both_box_from_rowand_order_from_rowre-derived partner fields with the samep["..."] if p else <default>fallbacks; the case-insensitive code lookup was duplicated acrossorder_by_code/redeem; andSELECT * FROM {orders,boxes} WHERE id=?was repeated in create/redeem/refund/box paths. Extracted helpers:3.
app/static/index.html— repeated fetch boilerplate. Thelet x=[];try{x=await get(url)}catch(e){}idiom appeared in every loader. Replaced with one helper:used by
loadStore,loadPartner,loadPartnerData,loadAdmin.No functional changes; net -47/+59 lines across 3 files.
Link to Devin session: https://app.devin.ai/sessions/30bd78e5e39c432abf0292dcecc4d4eb
Requested by: @wpalish