summaryrefslogtreecommitdiffstats
path: root/stats.php
diff options
context:
space:
mode:
Diffstat (limited to 'stats.php')
-rw-r--r--stats.php12
1 files changed, 4 insertions, 8 deletions
diff --git a/stats.php b/stats.php
index 2bf3f91..90c2aeb 100644
--- a/stats.php
+++ b/stats.php
@@ -41,16 +41,12 @@ $sort_order = array(
$current_order = switch_order($sort_order);
-// Find 30 days ago, then find how many raids occurred in those 30 days
-// Do the same for 60 and 90 days
-$thirty_days = mktime(0, 0, 0, date('m'), date('d')-30, date('Y'));
-$sixty_days = mktime(0, 0, 0, date('m'), date('d')-60, date('Y'));
-$ninety_days = mktime(0, 0, 0, date('m'), date('d')-90, date('Y'));
+$condition = "(raid_name = 'On time bonus' OR raid_name = 'Attendance Log')";
// Hack for 30/60/90 days attendance
-$raid_count_30 = $db->query_first('SELECT count(*) FROM ' . RAIDS_TABLE . ' WHERE raid_date BETWEEN '.$thirty_days.' AND '.time());
-$raid_count_60 = $db->query_first('SELECT count(*) FROM ' . RAIDS_TABLE . ' WHERE raid_date BETWEEN '.$sixty_days.' AND '.time());
-$raid_count_90 = $db->query_first('SELECT count(*) FROM ' . RAIDS_TABLE . ' WHERE raid_date BETWEEN '.$ninety_days.' AND '.time());
+$raid_count_30 = $db->query_first('SELECT count(*) FROM ' . RAIDS_TABLE . ' WHERE raid_date >= (unix_timestamp() - (30*24*3600)) AND ' . $condition);
+$raid_count_60 = $db->query_first('SELECT count(*) FROM ' . RAIDS_TABLE . ' WHERE raid_date >= (unix_timestamp() - (60*24*3600)) AND ' . $condition);
+$raid_count_90 = $db->query_first('SELECT count(*) FROM ' . RAIDS_TABLE . ' WHERE raid_date >= (unix_timestamp() - (90*24*3600)) AND ' . $condition);
//Total raids
$total_raids = $db->query_first('SELECT count(*) FROM ' . RAIDS_TABLE);