Skip to content

Show the total U/D ratio in the statistics tree #288

Description

@SevC10

In the statistics tree, the U/D ratio is shown only if the counters for the session are both >0. In particular, I'm referring to the function CStatTreeItemRatio::GetString() in StatTree.cpp.
Would be nice to always show the total U/D ratio, regardless of the session counters.

Something like that (I'm just showing the code to better focus what I mean):

if (v1 > 0 && v2 > 0) {
	if (v2 < v1) {
		ret = CFormat(wxT("%.2f : 1")) % (v1 / v2);
	} else {
		ret = CFormat(wxT("1 : %.2f")) % (v2 / v1);
	}

	if (m_totalfunc1 && m_totalfunc2) {
		double t1 = m_totalfunc1() + v1;
		double t2 = m_totalfunc2() + v2;
		if (t2 < t1) {
			ret += CFormat(wxT(" (%.2f : 1)")) % (t1 / t2);
		} else {
			ret += CFormat(wxT(" (1 : %.2f)")) % (t2 / t1);
		}
	}
} else {
	ret = _("Not available");
	
	/***
	/*** Add total ratio here ***
	/***
	
	if (m_totalfunc1 && m_totalfunc2) {
		double t1 = m_totalfunc1() + v1;
		double t2 = m_totalfunc2() + v2;
		if (t2 < t1) {
			ret += CFormat(wxT(" (%.2f : 1)")) % (t1 / t2);
		} else {
			ret += CFormat(wxT(" (1 : %.2f)")) % (t2 / t1);
		}
	}

	/***
	/*** end modification ***
	/***
}

Screenshot (italian interface):
Schermata del 2021-07-10 12-23-47

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions