Changeset 1413 for trunk/wifidog-auth/wifidog/classes/User.php
- Timestamp:
- 08/06/09 09:55:30 (3 years ago)
- Files:
-
- 1 modified
-
trunk/wifidog-auth/wifidog/classes/User.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/wifidog/classes/User.php
r1409 r1413 564 564 $sql .= " SUM (CASE WHEN node_id = '".$node->getId()."' THEN (incoming+outgoing) END) AS node_total_bytes, \n"; 565 565 $sql .= " SUM (timestamp_out - timestamp_in) AS network_duration, \n"; 566 $sql .= " SUM (CASE WHEN node_id = '".$node->getId()."' THEN ( timestamp_out - timestamp_in) END) AS node_duration \n";//For real566 $sql .= " SUM (CASE WHEN node_id = '".$node->getId()."' THEN (COALESCE(timestamp_out,last_updated) - timestamp_in) END) AS node_duration \n";//For real //The coalesce is to make sure the substraction returns a value for active conections, since active connections do not yet have a timestamp_out. Do NOT coalesce with CURRENT_TIMESTAMP, it could cause real problems for users in case of gateway crash. 567 567 $sql .= " FROM connections \n";//For real 568 568 $sql .= " JOIN nodes USING (node_id) \n";
