feat(falukant): enhance product pricing and nobility advancement features
All checks were successful
Deploy to production / deploy (push) Successful in 2m52s
All checks were successful
Deploy to production / deploy (push) Successful in 2m52s
- Updated the `getAllProductPricesInRegion` method in `FalukantService` to accept additional parameters for network worth and branch ID, improving pricing calculations based on user branches. - Enhanced the nobility advancement logic in `NobilityView` to display unmet requirements clearly, providing users with better feedback on advancement conditions. - Refactored the revenue calculation in `ProductionSection` to utilize a cached product prices object, optimizing performance and reducing redundant API calls. - Updated localization files to include new translations for attack sources across multiple languages, enhancing the user experience for diverse audiences. - Removed obsolete C++ worker references and streamlined the retention logic for production logs, ensuring efficient data management.
This commit is contained in:
@@ -20,7 +20,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="product in products" :key="product.id" :class="{ highlight: product.id === productWithMaxProfitPerMinute?.id }">
|
||||
<tr
|
||||
v-for="product in sortedProductsByProfitPerMinute"
|
||||
:key="product.id"
|
||||
:class="{ highlight: product.id === topProductByProfitPerMinute?.id }"
|
||||
>
|
||||
<td>{{ $t(`falukant.product.${product.labelTr}`) }}</td>
|
||||
<td>{{ product.knowledges && product.knowledges[0] ? product.knowledges[0].knowledge : 0 }}</td>
|
||||
<td>{{ calculateProductRevenue(product).absolute }}</td>
|
||||
@@ -72,13 +76,19 @@
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
productWithMaxProfitPerMinute() {
|
||||
if (!this.products || this.products.length === 0) return null;
|
||||
return this.products.reduce((maxProduct, currentProduct) => {
|
||||
const currentProfit = parseFloat(this.calculateProductProfit(currentProduct).perMinute);
|
||||
const maxProfit = maxProduct ? parseFloat(this.calculateProductProfit(maxProduct).perMinute) : Number.NEGATIVE_INFINITY;
|
||||
return currentProfit > maxProfit ? currentProduct : maxProduct;
|
||||
}, null);
|
||||
/** Gleiche Metrik wie Daemon: Gewinn/Minute ≈ (Erlös/Stück − Stückkosten) / Produktionszeit; höchste zuerst. */
|
||||
sortedProductsByProfitPerMinute() {
|
||||
if (!this.products || this.products.length === 0) return [];
|
||||
return [...this.products].sort((a, b) => {
|
||||
const pb = parseFloat(this.calculateProductProfit(b).perMinute);
|
||||
const pa = parseFloat(this.calculateProductProfit(a).perMinute);
|
||||
if (pb !== pa) return pb - pa;
|
||||
return (a.labelTr || '').localeCompare(b.labelTr || '');
|
||||
});
|
||||
},
|
||||
topProductByProfitPerMinute() {
|
||||
const list = this.sortedProductsByProfitPerMinute;
|
||||
return list.length ? list[0] : null;
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
|
||||
Reference in New Issue
Block a user