diff --git a/ajax/PointsCenter.php b/ajax/PointsCenter.php index 782939c..0cec9b2 100644 --- a/ajax/PointsCenter.php +++ b/ajax/PointsCenter.php @@ -430,13 +430,24 @@ public function getEventTotals() public function getIMPoints() { - return self::fetchAllQuery( - "SELECT nu_email, LEAST(SUM(count),15) AS total - FROM imcounts - WHERE count>=3 AND qtr=:qtr - GROUP BY nu_email", - PDO::FETCH_KEY_PAIR - ); + // There is not a minimum or maximum beginning Winter 2016 + if (self::$qtr >= 1601) { + return self::fetchAllQuery( + "SELECT nu_email, SUM(count) AS total + FROM imcounts + WHERE qtr=:qtr + GROUP BY nu_email", + PDO::FETCH_KEY_PAIR + ); + } else { + return self::fetchAllQuery( + "SELECT nu_email, LEAST(SUM(count),15) AS total + FROM imcounts + WHERE count>=3 AND qtr=:qtr + GROUP BY nu_email", + PDO::FETCH_KEY_PAIR + ); + } } public function getSlivkanPoints($nu_email) diff --git a/js/points-center/breakdown.js b/js/points-center/breakdown.js index 3090f50..7becf45 100644 --- a/js/points-center/breakdown.js +++ b/js/points-center/breakdown.js @@ -108,30 +108,44 @@ var getSlivkanPoints = function() { if (data.ims.length > 0) { $imsChart.show(); - _.forEach(data.ims, function(im) { - im.count = parseInt(im.count, 10); - imData.push([im.sport, im.count]); + // There is not a minimum or maximum beginning Winter 2016 + if (qtr >= 1601) { + _.forEach(data.ims, function(im) { + im.count = parseInt(im.count, 10); + + imData.push([im.sport, im.count]); - if (im.count >= 3) { imTotal += im.count; - } else { - imExtra += im.count; + }); + + drawChart($imsChart, imData, 'IM Points (' + imTotal + ' Total)', width); + } else { + _.forEach(data.ims, function(im) { + im.count = parseInt(im.count, 10); + + imData.push([im.sport, im.count]); + + if (im.count >= 3) { + imTotal += im.count; + } else { + imExtra += im.count; + } + }); + + if (imTotal > 15) { + imExtra += imTotal - 15; + imTotal = 15; } - }); - if (imTotal > 15) { - imExtra += imTotal - 15; - imTotal = 15; + drawChart( + $imsChart, + imData, + ['IMs (', imTotal, ' Points, ', imExtra, + (imExtra === 1 ? ' Doesn\'t' : ' Don\'t'), ' Count)'].join(''), + width + ); } - - drawChart( - $imsChart, - imData, - ['IMs (', imTotal, ' Points, ', imExtra, - (imExtra === 1 ? ' Doesn\'t' : ' Don\'t'), ' Count)'].join(''), - width - ); } else { $imsChart.hide(); }