From 832bc488b6e5bd4a634964ee10e1f7051fafc234 Mon Sep 17 00:00:00 2001 From: Felix Linker Date: Sun, 1 Nov 2020 18:25:28 +0100 Subject: [PATCH] Fix excluding modules from costs --- src/app/components/CostSection.jsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app/components/CostSection.jsx b/src/app/components/CostSection.jsx index d681e744..70123d1d 100644 --- a/src/app/components/CostSection.jsx +++ b/src/app/components/CostSection.jsx @@ -5,10 +5,10 @@ import Persist from '../stores/Persist'; import Ship from '../shipyard/Ship'; import { Insurance } from '../shipyard/Constants'; import TranslatedComponent from './TranslatedComponent'; -import { ShoppingIcon } from '../components/SvgIcons'; +import { ShoppingIcon } from './SvgIcons'; import autoBind from 'auto-bind'; import { assign, differenceBy, sortBy, reverse } from 'lodash'; -import { COST, FUEL_CAPACITY } from 'ed-forge/lib/ship-stats'; +import { FUEL_CAPACITY } from 'ed-forge/lib/ship-stats'; /** * Cost Section @@ -154,12 +154,18 @@ export default class CostSection extends TranslatedComponent { if (desc) { reverse(modules); } + + let totalCost = 0; for (let module of modules) { const cost = module.readMeta('cost'); const slot = module.getSlot(); if (cost) { let toggle = this._toggleExcluded.bind(this, slot); - rows.push( + const disabled = excluded[slot]; + if (!disabled) { + totalCost += cost; + } + rows.push( {module.getClassRating()} {translate(module.readMeta('type'))} {formats.int(cost * (1 - moduleDiscount))}{units.CR} @@ -167,7 +173,6 @@ export default class CostSection extends TranslatedComponent { } } - const totalCost = ship.get(COST); return