/
spider0
/
Spider0
Обзор
Документация
Войти
/
spider0
/
Spider0
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/lib/estimateEngine.js
41 строка
1 KB
AlexSpider0686
Implement AI survey design and evacuation plan recognition
28 мар 2026, 22:01
28 мар 2026, 22:01
1be6fca
Код
Авторство
О чём код?
import { calculateTotals } from "./estimate"; import { calculateSystemWithBreakdown } from "./systemCalculators/index.js"; export function calculateEstimateEngine( systems, zones, budget, objectData, vendorPriceSnapshots = {}, projectSpecSnapshots = {}, surveyAnswers = {} ) { const systemsDetailed = systems.map((system) => calculateSystemWithBreakdown( system, zones, budget, objectData, vendorPriceSnapshots?.[system.id] || null, projectSpecSnapshots?.[system.id] || null, systems, surveyAnswers ) ); const totals = calculateTotals(systemsDetailed); return { systemsDetailed, totals, }; } export function buildHowCalculated(systemResult) { if (!systemResult?.breakdown) return []; const equipmentLines = systemResult.breakdown.equipment.map( (item) => `${item.label}: ${Math.round(item.cost).toLocaleString("ru-RU")} ₽` ); const formulaLines = (systemResult.formulaRows || []).map( (item) => `${item.label}: x${Number(item.value || 0).toFixed(2)}` ); return [...systemResult.explanation, ...formulaLines, ...equipmentLines]; }