Avoid the warnings and when the max is integer show in the axis only integer values - refs #6876

1.9.x
Francis Gonzales 11 years ago
parent 8e905670c4
commit 8d5db145e3
  1. 6
      main/gradebook/lib/fe/flatviewtable.class.php
  2. 9
      main/gradebook/lib/flatview_data_generator.class.php

@ -184,7 +184,7 @@ class FlatViewTable extends SortableTable
if (is_array($customdisplays) && count(($customdisplays))) {
$user_results = $this->datagen->get_data_to_graph2();
$user_results = $this->datagen->get_data_to_graph2(false);
$pre_result = $new_result = array();
$DataSet = new pData();
//filling the Dataset
@ -296,8 +296,12 @@ class FlatViewTable extends SortableTable
//Setting max height by default see #3296
if (!empty($max)) {
if (is_int($max)) {
$Test->setFixedScale(0, $max + 1, $max + 1);
} else {
$Test->setFixedScale(0, $max);
}
}
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALLSTART0, 150, 150, 150, TRUE, 0, 1, FALSE);

@ -524,7 +524,12 @@ class FlatViewDataGenerator
return $data;
}
public function get_data_to_graph2 () {
/**
* This is a function to show the generated data
* @param type $displayWarning
* @return array
*/
public function get_data_to_graph2 ($displayWarning = true) {
// do some checks on users/items counts, redefine if invalid values
$usertable = array ();
foreach ($this->users as $user) {
@ -593,7 +598,9 @@ class FlatViewDataGenerator
}
$total_score=array($item_value,$item_total);
$score_final = ($item_value / $item_total) * 100;
if ($displayWarning) {
Display::display_warning_message( Display::display_warning_message($total_score[1]));
}
$row[] =array ($score_final, trim($scoredisplay->display_score($total_score, SCORE_CUSTOM, null, true)));
}

Loading…
Cancel
Save