mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2026-09-03 10:21:38 -04:00
This should close #42.
This commit is contained in:
@@ -41,30 +41,16 @@ if (isset($_POST['range1'])) {
|
||||
$today = $range2;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
|
||||
COUNT(shop_hours.contact_id) as cs_volunteer_visits,
|
||||
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS cs_volunteer_hours
|
||||
FROM shop_hours
|
||||
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
|
||||
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
|
||||
WHERE (time_in > DATE_SUB(CURDATE(),INTERVAL $days_range1 DAY) AND time_in <= DATE_SUB(CURDATE(), INTERVAL $days_range2 DAY))
|
||||
AND shop_user_roles.other_volunteer = 1
|
||||
GROUP BY contact_id
|
||||
ORDER BY sort_hours DESC;
|
||||
|
||||
*/
|
||||
|
||||
|
||||
$query = "SELECT contacts.contact_id, CONCAT(last_name, ', ', first_name, ' ',middle_initial) AS full_name,
|
||||
COUNT(shop_hours.contact_id) as cs_volunteer_visits,
|
||||
ROUND(SUM(HOUR(SUBTIME( TIME(time_out), TIME(time_in))) + MINUTE(SUBTIME( TIME(time_out), TIME(time_in)))/60)) AS cs_volunteer_hours
|
||||
ROUND(SUM(HOUR(TIMEDIFF( time_out, time_in)) + MINUTE(TIMEDIFF( time_out, time_in))/60)) AS cs_volunteer_hours
|
||||
FROM shop_hours
|
||||
LEFT JOIN contacts ON shop_hours.contact_id = contacts.contact_id
|
||||
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role = shop_user_roles.shop_user_role_id
|
||||
WHERE (SUBSTRING_INDEX(time_in, ' ', 1) >= DATE_SUB(CURDATE(),INTERVAL $days_range1 DAY) AND SUBSTRING_INDEX(time_in, ' ', 1) <= DATE_SUB(CURDATE(), INTERVAL $days_range2 DAY))
|
||||
AND shop_user_roles.other_volunteer = 1
|
||||
AND shop_hours.shop_user_role = 'Student Volunteer/Community Service Hours'
|
||||
GROUP BY contact_id
|
||||
ORDER BY cs_volunteer_hours DESC;";
|
||||
$cs_volunteers_sql = mysql_query($query, $YBDB) or die(mysql_error());
|
||||
|
||||
Reference in New Issue
Block a user