Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count totals for all available fields for both teams #40

Open
Nomad7 opened this issue Aug 12, 2022 · 1 comment
Open

Count totals for all available fields for both teams #40

Nomad7 opened this issue Aug 12, 2022 · 1 comment

Comments

@Nomad7
Copy link
Contributor

Nomad7 commented Aug 12, 2022

Currently, while per-player data for each team appears to be calculated correctly, the Total calculations for some fields are only done for one team, not the other. This works fine for OvD CTF games, but for ADL games it would make sense to sum all available fields.

I think this is the relevant code from templateUtils.ts:

// offense summary
        Handlebars.registerHelper('offenseSummary', function(this: OffenseTeamStats, damageStatsExist: boolean, teamId: string, players?: OutputPlayer[]) {
            const isComparison = teamId === 'Comp'; // first parameter can sometimes be object??
            return `
                <tr ${isComparison && 'class="comp"'}>
                    <td class="team">${TemplateUtils.getTeamName(teamId, players)}</td>
                    ${TemplateUtils.getRow(this.frags, isComparison, "kills-total")}
                    ${TemplateUtils.getRow(this.kills, isComparison, "kills")}
                    ${TemplateUtils.getRow(this.team_kills, isComparison, "team-kills")}
                    ${TemplateUtils.getRow(this.conc_kills, isComparison, "conc-kills")}
                    ${TemplateUtils.getRow(this.sg_kills, isComparison, "sentry-kills")}` +
                    (damageStatsExist ? `
                    ${TemplateUtils.getRow(this.damage_enemy, isComparison, "damage-enemy")}
                    ${TemplateUtils.getRow(this.damage_team, isComparison, "damage-team")}` : "") + `
                    ${TemplateUtils.getRow(this.deaths, isComparison, "deaths-total")}
                    ${TemplateUtils.getRow(this.d_enemy, isComparison, "deaths")}
                    ${TemplateUtils.getRow(this.d_self, isComparison, "suicides")}
                    ${TemplateUtils.getRow(this.d_team, isComparison, "team-deaths")}
                    ${TemplateUtils.getRow(this.concs, isComparison, "concs")}
                    ${TemplateUtils.getRow(this.caps, isComparison, "flag-captures")}
                    ${TemplateUtils.getRow(this.touches, isComparison, "flag-touches")}
                    ${TemplateUtils.getRow(this.toss_percent, isComparison, "flag-toss-percentage")}
                    ${TemplateUtils.getRow(this.flag_time, isComparison, "flag-time")}
                </tr>`;
        });

        Handlebars.registerHelper('defenseSummary', function(this: DefenseTeamStats, damageStatsExist: boolean, teamId: string, players?: OutputPlayer[]) {
            const isComparison = teamId === 'Comp'; // first parameter can sometimes be object??
            return `
                <tr ${isComparison && 'class="comp"'}>
                    <td class="team">${TemplateUtils.getTeamName(teamId, players)}</td>
                    ${TemplateUtils.getRow(this.frags, isComparison, "kills-total")}
                    ${TemplateUtils.getRow(this.kills, isComparison, "kills")}
                    ${TemplateUtils.getRow(this.team_kills, isComparison, "team-kills")}
                    ${TemplateUtils.getRow(this.conc_kills, isComparison, "conc-kills")}` +
                    (damageStatsExist ? `
                    ${TemplateUtils.getRow(this.damage_enemy, isComparison, "damage-enemy")}
                    ${TemplateUtils.getRow(this.damage_team, isComparison, "damage-team")}` : "") + `
                    ${TemplateUtils.getRow(this.deaths, isComparison, "deaths-total")}
                    ${TemplateUtils.getRow(this.d_enemy, isComparison, "deaths")}
                    ${TemplateUtils.getRow(this.d_self, isComparison, "suicides")}
                    ${TemplateUtils.getRow(this.d_team, isComparison, "team-deaths")}
                    ${TemplateUtils.getRow(this.airshots, isComparison, "airshots")}
                </tr>`;
        });

Several data points are totalled for blue but not for red, but looks like the only data that's unique to red team is ${TemplateUtils.getRow(this.airshots, isComparison, "airshots")}
Can these summations be merged so that no matter what team plays offense or defense, the data totals are counted?

@Nomad7
Copy link
Contributor Author

Nomad7 commented Aug 12, 2022

For an example of the totals not being counted, see http://app.hampalyzer.com/parsedlogs/OldSchool-2022-Aug-10-05-20/ - red team should have 22 SG kills, 7 Caps, lots of Touches, Cumulative flag time, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant