Skip to content

Commit

Permalink
Fix bug that would double-apply eq mods for certain wepmods:
Browse files Browse the repository at this point in the history
  • Loading branch information
vjosset committed Apr 9, 2023
1 parent 6058b8f commit 7060d6a
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 34 deletions.
44 changes: 24 additions & 20 deletions api/operativeportrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,18 @@ function DELETERosterOperativePortrait() {
}

// Success
// Update the operative's "hascustomportrait" field
global $dbcon;
$sql = "UPDATE RosterOperative SET hascustomportrait = 0 WHERE rosteropid = ?";
$cmd = $dbcon->prepare($sql);
$paramtypes = "s";
$params = array();
$params[] =& $paramtypes;
$params[] =& $ro->rosteropid;
call_user_func_array(array($cmd, "bind_param"), $params);
$cmd->execute();
if ($ro->hascustomportrait != 0) {
// Update the operative's "hascustomportrait" field
global $dbcon;
$sql = "UPDATE RosterOperative SET hascustomportrait = 0 WHERE rosteropid = ?";
$cmd = $dbcon->prepare($sql);
$paramtypes = "s";
$params = array();
$params[] =& $paramtypes;
$params[] =& $ro->rosteropid;
call_user_func_array(array($cmd, "bind_param"), $params);
$cmd->execute();
}

// Done
echo "OK";
Expand Down Expand Up @@ -255,16 +257,18 @@ function POSTRosterOperativePortrait() {
die();
} else {
// Success
// Update the operative's "hascustomportrait" field
global $dbcon;
$sql = "UPDATE RosterOperative SET hascustomportrait = 1 WHERE rosteropid = ?";
$cmd = $dbcon->prepare($sql);
$paramtypes = "s";
$params = array();
$params[] =& $paramtypes;
$params[] =& $ro->rosteropid;
call_user_func_array(array($cmd, "bind_param"), $params);
$cmd->execute();
if ($ro->hascustomportrait != 1) {
// Update the operative's "hascustomportrait" field
global $dbcon;
$sql = "UPDATE RosterOperative SET hascustomportrait = 1 WHERE rosteropid = ?";
$cmd = $dbcon->prepare($sql);
$paramtypes = "s";
$params = array();
$params[] =& $paramtypes;
$params[] =& $ro->rosteropid;
call_user_func_array(array($cmd, "bind_param"), $params);
$cmd->execute();
}

// Done
echo "OK";
Expand Down
2 changes: 1 addition & 1 deletion api/rosterportrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function DELETERosterPortrait() {
unlink($custrosterportraitpath);
}

if ($r->hascustomportrait != 1) {
if ($r->hascustomportrait != 0) {
// Update the roster's "hascustomportrait" field
global $dbcon;
$sql = "UPDATE Roster SET hascustomportrait = 0 WHERE rosterid = ?";
Expand Down
4 changes: 2 additions & 2 deletions header.shtml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
<script type="text/javascript" src="/js/utils.js?cb=202302181302"></script>

<!-- App/Controller -->
<link rel="preload" href="/js/app.js?cb=202304020854" as="script">
<script type="text/javascript" src="/js/app.js?cb=202304020854"></script>
<link rel="preload" href="/js/app.js?cb=202304091158" as="script">
<script type="text/javascript" src="/js/app.js?cb=202304091158"></script>

<!-- Fonts -->
<!-- Oswald Font -->
Expand Down
9 changes: 5 additions & 4 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,18 +554,19 @@ var app = angular.module("kt", ['ngSanitize'])

// Reset this operative's weapons to their base definitions
//console.log(" Resetting weapons");
op.weapons = [];
let wepids = op.wepids.split(",");
for (let opwepnum = 0; opwepnum < op.weapons.length; opwepnum++) {
let opwep = op.weapons[opwepnum];
//console.log(" Weapon " + opwep.wepid);
for (let opwepidnum = 0; opwepidnum < wepids.length; opwepidnum++) {
let wepid = wepids[opwepidnum];

// Find this weapon in the base operative's weapons
for (let baseopwepnum = 0; baseopwepnum < op.baseoperative.weapons.length; baseopwepnum++) {
let baseopwep = op.baseoperative.weapons[baseopwepnum];
if (baseopwep.wepid == opwep.wepid) {
if (baseopwep.wepid == wepid) {
// Found the weapon, reset its stats
//console.log(" Resetting weapon to base stats");
opwep = JSON.parse(JSON.stringify(baseopwep));
op.weapons.push(opwep);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion killteam.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
<div class="tab-pane" id="rosters" role="tabpanel">
<div class="m-0 p-0">
<div ng-if="killteam.rosters.length > 0" class="row p-0 m-0">
<div class="col-12 col-md-6 col-xl-4 m-0 p-0" ng-repeat="myRoster in killteam.rosters track by $index">
<div class="col-12 col-md-6 col-lg-4 col-xl-3 m-0 p-0" ng-repeat="myRoster in killteam.rosters track by $index">
<?php include "templates/roster_card.shtml" ?>
</div>
</div>
Expand Down
10 changes: 6 additions & 4 deletions notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ SQL Queries:
SELECT * FROM Event WHERE userip != '68.80.166.102' ORDER BY eventid DESC LIMIT 1000;
#SELECT * FROM Event WHERE eventtype = 'session' AND action = 'signup' AND userip != '68.80.166.102' ORDER BY eventid DESC LIMIT 100;
SELECT CAST(datestamp AS Date) AS Date, SUM(CASE WHEN action = 'signup' THEN 1 ELSE 0 END) AS SignupCount, COUNT(DISTINCT userip) AS UserCount, SUM(CASE WHEN eventtype = 'page' THEN 1 ELSE 0 END) AS PageViews FROM Event WHERE userip != '68.80.166.102' GROUP BY CAST(datestamp AS Date) ORDER BY 1 DESC;
SELECT referrer, COUNT(*) AS ReferrerCount FROM Event WHERE referrer != '' AND referrer NOT LIKE 'https://ktdash.app%' AND userip != '68.80.166.102' AND datestamp > DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -7 day) GROUP BY referrer ORDER BY COUNT(*) DESC LIMIT 100;
SELECT CAST(datestamp AS Date) AS Date, COUNT(*) AS TotalEventCount, SUM(CASE sessiontype WHEN 'pwa' THEN 1 ELSE 0 END) AS PWAEventCount, SUM(CASE sessiontype WHEN 'pwa' THEN 0 ELSE 1 END) AS BrowserEventCount FROM Event WHERE userip != '68.80.166.102' AND datestamp > DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -10 day) AND userid != '[anon]' GROUP BY CAST(datestamp AS Date) ORDER BY 1 DESC;
SELECT referrer, COUNT(*) AS ReferrerCount7Days FROM Event WHERE referrer != '' AND referrer NOT LIKE 'https://ktdash.app%' AND userip != '68.80.166.102' AND datestamp > DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -7 day) GROUP BY referrer ORDER BY COUNT(*) DESC LIMIT 100;
SELECT * FROM Event WHERE action IN ('portrait', 'opportrait') AND userip != '68.80.166.102' AND label = 'custom' ORDER BY eventid DESC LIMIT 100;
#SELECT * FROM Event WHERE action = 'gallery' AND userip != '68.80.166.102' ORDER BY eventid DESC LIMIT 100;
#SELECT * FROM Event WHERE action IN ('import', 'clone') AND userip != '68.80.166.102' ORDER BY eventid DESC;
Expand All @@ -45,16 +46,17 @@ SQL Queries:
SELECT ' 7 Days' AS Period, COUNT(DISTINCT userid) AS DistinctActiveUsers FROM Event WHERE userid != 'anon' AND datestamp > DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -7 day) UNION
SELECT '14 Days' AS Period, COUNT(DISTINCT userid) AS DistinctActiveUsers FROM Event WHERE userid != 'anon' AND datestamp > DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -14 day) UNION
SELECT '21 Days' AS Period, COUNT(DISTINCT userid) AS DistinctActiveUsers FROM Event WHERE userid != 'anon' AND datestamp > DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -21 day) UNION
SELECT '28 Days' AS Period, COUNT(DISTINCT userid) AS DistinctActiveUsers FROM Event WHERE userid != 'anon' AND datestamp > DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -28 day);
SELECT '28 Days' AS Period, COUNT(DISTINCT userid) AS DistinctActiveUsers FROM Event WHERE userid != 'anon' AND datestamp > DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -28 day) UNION
SELECT '90 Days' AS Period, COUNT(DISTINCT userid) AS DistinctActiveUsers FROM Event WHERE userid != 'anon' AND datestamp > DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -90 day);

# Killteams that don't have spotlighted or prebuilt roster
# Killteams that don't have spotlighted or prebuilt roster
SELECT *
FROM Killteam K LEFT JOIN Roster R
ON R.factionid = K.factionid AND R.killteamid = K.killteamid AND (R.spotlight = 1 OR R.userid = 'prebuilt')
WHERE R.rosterid IS NULL


# Action/Event Log
# Action/Event Log
ALTER VIEW EventLogView
AS
SELECT
Expand Down
2 changes: 1 addition & 1 deletion rosters.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@

<div class="m-0 p-0">
<div ng-if="myRosters.length > 0" class="row p-0 m-0">
<div class="col-12 col-md-6 col-lg-4 m-0 p-0" ng-repeat="myRoster in myRosters | orderBy: 'seq'">
<div class="col-12 col-md-6 col-lg-4 col-xl-3 m-0 p-0" ng-repeat="myRoster in myRosters | orderBy: 'seq'">
<?php
//if ($me->userid == 'vince') {
// include "templates/roster_card2.shtml";
Expand Down
2 changes: 1 addition & 1 deletion topnav.shtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</h1>
</a>

<h3 class="text-small p-1 m-0 shadow-none border-none" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<h3 class="navbar-toggler p-1 m-0 shadow-none border-none" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars fa-fw"></i>
</h3>

Expand Down

0 comments on commit 7060d6a

Please sign in to comment.