Skip to content
Snippets Groups Projects
Commit 059aad8a authored by Bruno Massa's avatar Bruno Massa
Browse files

Bugs fixed:

* Node activity from Charts system fixed.
parent 63faa7d9
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,7 @@ function _charts_system_charts($ctype) { ...@@ -48,7 +48,7 @@ function _charts_system_charts($ctype) {
FROM {users_roles} ur FROM {users_roles} ur
LEFT JOIN {users} u ON ur.uid = u.uid LEFT JOIN {users} u ON ur.uid = u.uid
LEFT JOIN {role} r ON r.rid = ur.rid LEFT JOIN {role} r ON r.rid = ur.rid
GROUP BY r.rid GROUP BY r.rid, r.name
ORDER BY r.name' ORDER BY r.name'
); );
$output .= _charts_system_generate( $output .= _charts_system_generate(
...@@ -147,24 +147,22 @@ function _charts_system_node_activity() { ...@@ -147,24 +147,22 @@ function _charts_system_node_activity() {
while ($result = db_fetch_array($results)) { while ($result = db_fetch_array($results)) {
$day = ltrim(date('d', $result['created']), '0'); $day = ltrim(date('d', $result['created']), '0');
$types[] = $result['type']; $types[$result['type']] = $type++;
$counts[$day][$result['type']]++; $counts[$day][$result['type']]++;
} }
// Generate data and labels // Generate data and labels
if (!empty($counts)) { if (!empty($counts)) {
for ($i = 1; $i <= date('d', $now); $i++) { foreach ($types as $type => $index) {
foreach ($types as $index => $type) { $chart[$type]['#legend'] = $type;
$chart[$index]['#legend'] = $type; for ($i = 1; $i <= date('d', $now); $i++) {
$chart[$index][] = array( $chart[$type][] = array(
'#value' => empty($counts[$i][$type]) ? 0 : $counts[$i][$type], '#value' => empty($counts[$i][$type]) ? 0 : $counts[$i][$type],
'#label' => empty($index) ? $i : NULL '#label' => $i
); );
} }
} }
}
if (!empty($chart)) {
$chart['#title'] = t('Activity for !date', array('!date' => date('F Y', $now))); $chart['#title'] = t('Activity for !date', array('!date' => date('F Y', $now)));
$chart['#type'] = 'line2D'; $chart['#type'] = 'line2D';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment