Skip to content

Commit

Permalink
Updated BR index to new prepopulated statistics.
Browse files Browse the repository at this point in the history
  • Loading branch information
ta2edchimp committed Oct 2, 2015
1 parent d0654b5 commit ee81179
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
17 changes: 8 additions & 9 deletions classes/Battle.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,21 +728,20 @@ public static function getList(array $options = array()) {
($onlyIDs === true ? "" : (", br.brTitle as title, br.brSummary as summary, br.brStartTime as startTime, br.brEndTime as endTime, br.brPublished as published, " .
"br.brCreatorUserID as creatorUserID, ifnull(u.userName, '') as creatorUserName, " .
"br.brUniquePilotsTeamA, br.brUniquePilotsTeamB, br.brUniquePilotsTeamC, " .
"ifnull((select sum(c.priceTag) from brCombatants as c where c.brHidden = 0 and c.brBattlePartyID = (" .
"select bp.brBattlePartyID from brBattleParties as bp where bp.battleReportID = br.battleReportID and bp.brTeamName = 'teamA' limit 1" .
")), 0.0) as iskLostTeamA, " .
"ifnull((select sum(c.priceTag) from brCombatants as c where c.brHidden = 0 and c.brBattlePartyID = (" .
"select bp.brBattlePartyID from brBattleParties as bp where bp.battleReportID = br.battleReportID and bp.brTeamName = 'teamB' limit 1" .
")), 0.0) as iskLostTeamB, " .
"ifnull((select sum(c.priceTag) from brCombatants as c where c.brHidden = 0 and c.brBattlePartyID = (" .
"select bp.brBattlePartyID from brBattleParties as bp where bp.battleReportID = br.battleReportID and bp.brTeamName = 'teamC' limit 1" .
")), 0.0) as iskLostTeamC, " .
"teamA.brIskLost as iskLostTeamA, teamB.brIskLost as iskLostTeamB, teamC.brIskLost as iskLostTeamC, " .
"teamA.brEfficiency as efficiency, " .
"sys.solarSystemName, " .
"(select count(commentID) from brComments as cm where cm.battleReportID = br.battleReportID and cm.commentDeleteTime is NULL) as commentCount, " .
"(select count(videoID) from brVideos as v where v.battleReportID = br.battlereportID) as footageCount ")) .
"from brBattles as br " .
($onlyIDs === true ? "" : ("inner join mapSolarSystems as sys " .
"on br.solarSystemID = sys.solarSystemID " .
"inner join brBattleParties as teamA " .
"on br.battleReportID = teamA.battleReportID and teamA.brTeamName = 'teamA' " .
"inner join brBattleParties as teamB " .
"on br.battleReportID = teamB.battleReportID and teamB.brTeamName = 'teamB' " .
"inner join brBattleParties as teamC " .
"on br.battleReportID = teamC.battleReportID and teamC.brTeamName = 'teamC' " .
"left outer join brUsers as u on u.userID = br.brCreatorUserID ")) .
"where br.brDeleteTime is NULL " .
($onlyPublished ? "and br.brPublished = 1 " : "") .
Expand Down
8 changes: 4 additions & 4 deletions public/themes/default/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ <h1>{{ BR_OWNER }}'s BattleReports</h1>
</td>
{% endif %}
<td class="hidden-sm hidden-xs hidden-xxs hidden-xxxs">&nbsp;</td>
{% if battle.efficiency == 1 %}
{% if battle.efficiency == 100 %}
{% set efficiencyClsName = 'text-success' %}
{% elseif battle.efficiency > 0.5 %}
{% elseif battle.efficiency > 50 %}
{% set efficiencyClsName = 'text-info' %}
{% elseif battle.efficiency > 0.1 %}
{% elseif battle.efficiency > 10 %}
{% set efficiencyClsName = 'text-warning' %}
{% else %}
{% set efficiencyClsName = 'text-danger' %}
{% endif %}
<td class="no-break text-right {{ efficiencyClsName }}"><strong>{{ (battle.efficiency * 100)|number_format(2, '.', ',') }}%</strong></td>
<td class="no-break text-right {{ efficiencyClsName }}"><strong>{{ battle.efficiency|number_format(2, '.', ',') }}%</strong></td>
</tr>
{% endfor %}
</tbody>
Expand Down
12 changes: 6 additions & 6 deletions views/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
if ($previewEndTime < $battle["endTime"])
$previewEndTime = $battle["endTime"];

$totalLost = $battle["iskLostTeamA"] + $battle["iskLostTeamB"] + $battle["iskLostTeamC"];
if ($totalLost > 0.0)
$battle["efficiency"] = 1.0 - $battle["iskLostTeamA"] / $totalLost;
else
$battle["efficiency"] = 0.0;
// $totalLost = $battle["iskLostTeamA"] + $battle["iskLostTeamB"] + $battle["iskLostTeamC"];
// if ($totalLost > 0.0)
// $battle["efficiency"] = 1.0 - $battle["iskLostTeamA"] / $totalLost;
// else
// $battle["efficiency"] = 0.0;

$previewISKdestroyed = $previewISKdestroyed + $totalLost;
// $previewISKdestroyed = $previewISKdestroyed + $totalLost;
$previewEfficiencyAvg = $previewEfficiencyAvg + $battle["efficiency"];

$battle["hasAAR"] = !empty($battle["summary"]);
Expand Down

0 comments on commit ee81179

Please sign in to comment.