﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	resolution	keywords	cc	phab_field
6561	Avoid unnecessary decimal points for resource statistics in the Summary	Langbart		"* Related forum thread: [https://wildfiregames.com/forum/topic/82754-alpha-26-pre-releaserelease-candidate-build-testing/?do=findComment&comment=502546 Alpha 26 Pre-release/Release Candidate Build Testing] (9/Jun/22)
[[Image(deci_sum.jpg, 600px, center)]]

==== possible solution
Some values e.g. `military` or the `economy score` already receive a `Math.round` treatment (see [https://code.wildfiregames.com/source/0ad/browse/ps/trunk/binaries/data/mods/public/gui/summary/counters.js$128 summary/counters.js]).


{{{#!js lineno=128 marks=140,148-151
/**
 * Keep this in sync with the score computation in session/ for the lobby rating reports!
 */
function calculateEconomyScore(playerState, index)
{
	let total = 0;

	// Notice that this skips the vegetarianFood property of resourcesGathered
	for (let type of g_ResourceData.GetCodes())
		total += playerState.sequences.resourcesGathered[type][index];

	total += playerState.sequences.tradeIncome[index];
	return Math.round(total / 10);
}

/**
 * Keep this in sync with the score computation in session/ for the lobby rating reports!
 */
function calculateMilitaryScore(playerState, index)
{
	return Math.round((playerState.sequences.enemyUnitsKilledValue[index] +
		playerState.sequences.unitsCapturedValue[index] +
		playerState.sequences.enemyBuildingsDestroyedValue[index] +
		playerState.sequences.buildingsCapturedValue[index]) / 10);
}
}}}

Adding `Math.round` to more statistics seems like a quick&dirty solution.

{{{#!js lineno=223 marks=226-228
function calculateResources(playerState, index, type)
{
	return {
		""count"": playerState.sequences.resourcesCount[type][index],
		""gathered"": playerState.sequences.resourcesGathered[type][index],
		""used"": playerState.sequences.resourcesUsed[type][index] - playerState.sequences.resourcesSold[type][index]
	};
}
}}}


==== related ticket
Similar problem, but no mention of the decimal problem
* #4097 - Not enough space for resources in summary screen (12/Jul/16)

==== related patch
A similar problem was recently fixed for tooltips
* Phab:D4332 - Ceil the resource costs for insufficient resources. (23/Jan/22)"	enhancement	new	Should Have	Alpha 26	UI & Simulation				
