Compare commits
6
Commits
v3.32
...
34cee5f874
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34cee5f874 | ||
|
|
a321dab448 | ||
|
|
dd70b6065b | ||
|
|
e5aa1dfd38 | ||
|
|
bc17c18943 | ||
|
|
97629a1441 |
No files matched your search
@@ -16,6 +16,7 @@ Project-specific architecture and operational contracts.
|
||||
| [09-vendor-spec.md](09-vendor-spec.md) | Vendor BOM and CFXML import contract |
|
||||
| [10-agent-api-guide.md](10-agent-api-guide.md) | End-to-end API guide for agents pricing servers from a TZ |
|
||||
| [11-lot-suggestions.md](11-lot-suggestions.md) | lot_suggestion column in qt_vendor_partnumber_seen — write/read contract for manual UI mappings |
|
||||
| [decisions/](decisions/README.md) | Architectural decision log, one file per decision |
|
||||
|
||||
## Rules
|
||||
|
||||
|
||||
@@ -43,3 +43,7 @@ is missing or ≤ 0:
|
||||
"latest active `world` pricelist," not a per-configuration pin.
|
||||
- If no `world` pricelist exists locally, behavior is unchanged (missing prices stay "—",
|
||||
no error).
|
||||
- How the footer totals surface this fallback is decided separately in
|
||||
[2026-07-24-pricing-total-world-share.md](2026-07-24-pricing-total-world-share.md);
|
||||
membership of world LOTs in the configurator's LOT set is decided in
|
||||
[2026-07-24-component-universe-world-union.md](2026-07-24-component-universe-world-union.md).
|
||||
@@ -0,0 +1,47 @@
|
||||
# Decision: pricing totals signal the world-fallback share, not row coverage
|
||||
|
||||
**Date:** 2026-07-24
|
||||
**Status:** active
|
||||
|
||||
## Context
|
||||
|
||||
The footer totals of both "Ценообразование" tables used to mean one thing: a red number
|
||||
with a trailing `*` said "prices are missing for some positions (N of M)". Two problems:
|
||||
|
||||
- the asterisk was a separate `<span>` after the number and wrapped onto its own line,
|
||||
pushing the footer layout around;
|
||||
- coverage was the wrong thing to warn about. Since
|
||||
[2026-07-10-world-pricelist-fallback.md](2026-07-10-world-pricelist-fallback.md) a
|
||||
missing price is silently filled from the `world` pricelist, so the total is rarely
|
||||
incomplete — it is *contaminated*. A sum resting on world stand-in prices looked exactly
|
||||
like a sum of real ones.
|
||||
|
||||
## Decision
|
||||
|
||||
`_setPricingTotal` in `web/templates/index.html` renders every footer total for Estimate,
|
||||
Склад and Конкуренты in both tables (buy and sale):
|
||||
|
||||
- No asterisk, ever. The number stands alone.
|
||||
- The total is red **if and only if** part of it was computed from `world` prices — that
|
||||
is, `worldTotal > 0`. A clean sum is not coloured. Red is a contamination signal, not a
|
||||
coverage signal.
|
||||
- The world share per column is accumulated from the same per-row flags that tint the
|
||||
cells amber (`estWorld` / `whWorld` / `compWorld`), summed over line totals, not unit
|
||||
prices.
|
||||
- Hovering the total opens a styled popup (`.pricing-total-tip` in `web/static/app.css`),
|
||||
not a `title=` tooltip — the native one appears too late to notice on a number the user
|
||||
is meant to distrust. It states the exact percentage and, when prices are genuinely
|
||||
missing for some rows, adds the coverage line that the asterisk used to carry.
|
||||
- "Ручная цена" is not part of this: it is user input, never world-derived.
|
||||
|
||||
## Consequences
|
||||
|
||||
- Red in the pricing footer means "part of this sum is a stand-in price", nothing else.
|
||||
Do not reuse it for coverage, staleness or any other condition.
|
||||
- The colour and popup classes are re-applied on every render and stripped first, so they
|
||||
never accumulate across re-renders.
|
||||
- The totals are written with `innerHTML` (number plus popup element). Nothing may read
|
||||
`textContent` off `#pricing-total-*-estimate|warehouse|competitor`; the vendor-price
|
||||
column and row `data-` attributes remain the read path for `applyCustomPrice` and
|
||||
`_getPricingEstimateTotal`.
|
||||
- The old `_setPartialTotal` helper is gone; do not reintroduce a coverage-only signal.
|
||||
@@ -104,7 +104,7 @@ func (r *ConfigurationRepository) ListAll(offset, limit int) ([]models.Configura
|
||||
|
||||
r.db.Model(&models.Configuration{}).Count(&total)
|
||||
err := r.db.
|
||||
Order("created_at DESC").
|
||||
Order("created_at DESC, id DESC").
|
||||
Offset(offset).
|
||||
Limit(limit).
|
||||
Find(&configs).Error
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package sync
|
||||
|
||||
import "fmt"
|
||||
|
||||
// SyncQtSettings pulls qt_settings (tab_config, config_types, etc.) from
|
||||
// MariaDB into the local cache so the configurator picks up server-driven
|
||||
// category/tab changes without requiring a client rebuild.
|
||||
func (s *Service) SyncQtSettings() error {
|
||||
mariaDB, err := s.getDB()
|
||||
if err != nil {
|
||||
return fmt.Errorf("database not available: %w", err)
|
||||
}
|
||||
|
||||
return s.localDB.SyncQtSettings(mariaDB)
|
||||
}
|
||||
@@ -100,5 +100,10 @@ func (w *Worker) runSync() {
|
||||
w.logger.Warn("background sync: failed to pull partnumber books", "error", err)
|
||||
}
|
||||
|
||||
// Pull configurator settings (tab_config, categories, etc.)
|
||||
if err := w.service.SyncQtSettings(); err != nil {
|
||||
w.logger.Warn("background sync: failed to sync qt_settings", "error", err)
|
||||
}
|
||||
|
||||
w.logger.Info("background sync cycle completed")
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
- список допустимых LOT конфигуратора собирается из объединения прайслистов `world` и `estimate`, а не только из `estimate`. Прежняя область видимости молча теряла сопоставления BOM: резолвер находил LOT по книге партномеров, которая про прайслисты ничего не знает, а фронт отбрасывал всё, чего нет в estimate — при этом в корзину такой LOT всё равно попадал, и строка BOM оставалась с «н/д». Дедупликация по имени LOT без учёта регистра, при совпадении выигрывает запись из estimate; позиции, найденные только в world, показываются с качеством цены 0 (самый красный);
|
||||
- LOT, сопоставленный по книге партномеров, сохраняется в спецификации, даже если его нет ни в одном прайслисте — раньше такое сопоставление пропадало без предупреждения. LOT, введённые руками, по-прежнему проверяются по списку;
|
||||
- кнопка «Пересопоставить» на вкладке BOM — заново прогоняет строки через актуальную книгу партномеров. При открытии конфигурации сопоставления намеренно остаются такими, какими были сохранены, поэтому записи, добавленные в книгу позже, подхватываются только этой кнопкой;
|
||||
- вкладка «Ценообразование»: убраны звёздочки у итогов (переносились на отдельную строку и разъезжались), все три суммы — Estimate, Склад, Конкуренты — показываются красным, а при наведении всплывает подсказка с долей суммы, посчитанной по ценам-заглушкам из прайслиста `world`, и с покрытием по позициям;
|
||||
- вкладка «Ценообразование»: убраны звёздочки у итогов (переносились на отдельную строку и разъезжались). Итог по столбцам Estimate, Склад и Конкуренты подсвечивается красным тогда и только тогда, когда часть суммы посчитана по ценам-заглушкам из прайслиста `world`; при наведении всплывает подсказка с точной долей таких цен и с покрытием по позициям;
|
||||
- колонка «PN вендора» на вкладке «Ценообразование» больше не переносит партномер на две строки;
|
||||
- индикатор качества цены показывается во всех таблицах конфигуратора, а не только на вкладке Base; колонка-индикатор везде без текстового заголовка, только с тултипом.
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# QuoteForge v3.33
|
||||
|
||||
Дата релиза: 2026-07-30
|
||||
Тег: `v3.33`
|
||||
|
||||
Предыдущий релиз: `v3.32`
|
||||
|
||||
## Ключевые изменения
|
||||
|
||||
- новые категории прайслиста (например `SYS`), не входящие ни в одну известную вкладку конфигуратора, больше не пропадают из «Прочее» — устранены три места самоотравления `ASSIGNED_CATEGORIES`, сведены в одну функцию;
|
||||
- фоновая синхронизация `qt_settings` (tab_config, config_types, required_categories, поддержка) подключена к воркеру — раньше была мёртвым кодом, и правки в центральной таблице не доезжали до клиентов;
|
||||
- детерминированная сортировка при постраничной выдаче конфигураций (`ListAll`).
|
||||
|
||||
## Запуск на macOS
|
||||
|
||||
Снимите карантинный атрибут через терминал: `xattr -d com.apple.quarantine /path/to/qfs-darwin-arm64`
|
||||
После этого бинарник запустится без предупреждения Gatekeeper.
|
||||
+26
-18
@@ -474,9 +474,17 @@ let TAB_CONFIG = {
|
||||
}
|
||||
};
|
||||
|
||||
let ASSIGNED_CATEGORIES = Object.values(TAB_CONFIG)
|
||||
.flatMap(t => t.categories)
|
||||
.map(c => ciStr(c));
|
||||
// Categories belonging to any real tab (everything except "other").
|
||||
// "other" is defined as "whatever isn't in this set" — it must never
|
||||
// contribute to it, or its own contents would exclude themselves.
|
||||
function computeAssignedCategories() {
|
||||
return Object.entries(TAB_CONFIG)
|
||||
.filter(([key]) => key !== 'other')
|
||||
.flatMap(([, t]) => t._allCategories || t.categories)
|
||||
.map(c => ciStr(c));
|
||||
}
|
||||
|
||||
let ASSIGNED_CATEGORIES = computeAssignedCategories();
|
||||
|
||||
// State
|
||||
let configUUID = '{{.ConfigUUID}}';
|
||||
@@ -822,23 +830,20 @@ async function loadCategoriesFromAPI() {
|
||||
categoryOrderMap[ciStr(cat.code)] = cat.display_order;
|
||||
});
|
||||
|
||||
// Build list of unassigned categories
|
||||
const knownCodes = Object.values(TAB_CONFIG)
|
||||
.flatMap(t => t.categories)
|
||||
.map(c => ciStr(c));
|
||||
// Build list of unassigned categories (excludes "other" itself, so
|
||||
// this stays correct even if it's re-run after "other" was already
|
||||
// populated by a previous call).
|
||||
const knownCodes = computeAssignedCategories();
|
||||
|
||||
const unassignedCategories = cats
|
||||
.filter(cat => !knownCodes.includes(ciStr(cat.code)))
|
||||
.sort((a, b) => a.display_order - b.display_order)
|
||||
.map(cat => cat.code);
|
||||
|
||||
ASSIGNED_CATEGORIES = knownCodes;
|
||||
|
||||
// Update "other" tab with unassigned categories
|
||||
TAB_CONFIG.other.categories = unassignedCategories;
|
||||
|
||||
// Rebuild ASSIGNED_CATEGORIES
|
||||
ASSIGNED_CATEGORIES = Object.values(TAB_CONFIG)
|
||||
.flatMap(t => t.categories)
|
||||
.map(c => ciStr(c));
|
||||
} catch(e) {
|
||||
console.error('Failed to load categories, using defaults', e);
|
||||
// Will use default configuration if API fails
|
||||
@@ -882,8 +887,12 @@ function applyServerSettings(settings) {
|
||||
sections: tab.sections || undefined
|
||||
};
|
||||
});
|
||||
// Rebuild ASSIGNED_CATEGORIES from the known (non-"other") tabs only,
|
||||
// before restoring .other — otherwise categories already parked in
|
||||
// .other (e.g. by loadCategoriesFromAPI) get counted as "assigned"
|
||||
// and immediately excluded from the "other" tab again.
|
||||
ASSIGNED_CATEGORIES = computeAssignedCategories();
|
||||
TAB_CONFIG.other = otherTab || { categories: [], singleSelect: false, label: 'Other' };
|
||||
ASSIGNED_CATEGORIES = Object.values(TAB_CONFIG).flatMap(t => t.categories).map(c => ciStr(c));
|
||||
}
|
||||
|
||||
// always_visible_tabs
|
||||
@@ -1394,11 +1403,10 @@ function applyConfigTypeToTabs() {
|
||||
}
|
||||
});
|
||||
|
||||
// Rebuild assigned categories index using the full static list (_allCategories),
|
||||
// not the filtered one — hidden categories still belong to their tab, not to Other.
|
||||
ASSIGNED_CATEGORIES = Object.values(TAB_CONFIG)
|
||||
.flatMap(t => t._allCategories || t.categories)
|
||||
.map(c => ciStr(c));
|
||||
// Rebuild assigned categories index using the full static list
|
||||
// (_allCategories), not the filtered one — hidden categories still
|
||||
// belong to their tab, not to Other.
|
||||
ASSIGNED_CATEGORIES = computeAssignedCategories();
|
||||
}
|
||||
|
||||
function updateTabVisibility() {
|
||||
|
||||
Reference in new issue
Block a user