Skip to content

Commit

Permalink
Merge pull request #13 from eLearning-BS23/recheck
Browse files Browse the repository at this point in the history
removed show grade
  • Loading branch information
sinthy08 authored Dec 23, 2022
2 parents 8d84959 + a9d4c92 commit 9bfccc6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 62 deletions.
13 changes: 11 additions & 2 deletions amd/build/configure_block.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/configure_block.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions amd/src/configure_block.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ export const init = () => {
*/
function mangeCourseInputField() {
var dbcharttype = $("#id_config_dashboardcharttype :selected").val();
if (dbcharttype == "grades") {
document.getElementById("courseleaderboard_configs").style.display =
"block";
} else {
document.getElementById("courseleaderboard_configs").style.display =
"none";
}
}
mangeCourseInputField();

Expand Down
49 changes: 0 additions & 49 deletions block_dashboardchart.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ public function make_custom_content() {
$dashboardtype = $this->make_category_course_table($datalimit);
} else if ($this->config->dashboardcharttype == 'login') {
$dashboardtype = $this->make_login_table($datalimit);
} else if ($this->config->dashboardcharttype == 'grades') {
$dashboardtype = $this->make_course_grade_table($datalimit);
} else if ($this->config->dashboardcharttype == 'active_courses') {
$dashboardtype = $this->make_most_active_courses_table($datalimit);
} else {
Expand Down Expand Up @@ -262,53 +260,6 @@ public function make_course_student_table($datalimit) {
get_string('mostactive_desc', 'block_dashboardchart'));
}

/**
* Getting data within a limit
* @param int $datalimit
* @return string
* @throws dml_exception
*/
public function make_course_grade_table($datalimit) {
global $DB, $USER;

$courseid = $this->config->courseid;
if ($courseid == null) {
return 'select a course to show grade data';
}
$userid = $USER->id;
$sql = "SELECT round(gg.rawgrade,2) as grade, gi.itemname
FROM {grade_grades} as gg
JOIN {grade_items} as gi on gi.courseid={$courseid}
WHERE gg.itemid=gi.id AND gg.userid={$userid} AND (gg.rawgrade) is not null";

$records = $DB->get_records_sql($sql, null, 0, $datalimit);

$series = [];
$labels = [];

foreach ($records as $data) {
$series[] = $data->grade;
}

$sql = "SELECT itemname FROM {grade_items} where courseid={$courseid} and itemname is not null";

$records = $DB->get_records_sql($sql, null, 0, $datalimit);

foreach ($records as $data) {
$labels[] = $data->itemname;
}
while (count($series) < count($labels)) {
$series[] = 0;
}

$sql = "SELECT fullname FROM {course} where id={$courseid}";
$coursename = $DB->get_record_sql($sql, null, 0, $datalimit);

return $this->display_graph($series, $labels,
get_string('earnedgrades', 'block_dashboardchart'),
$coursename->fullname);
}

/**
* Display graph.
* @param float[] $seriesvalue
Expand Down
1 change: 0 additions & 1 deletion edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ protected function specific_definition($mform) {
$dashboardcharttype[""] = get_string('dashboardcharttype:select', 'block_dashboardchart');
$dashboardcharttype["coursewiseenrollment"] = get_string('dashboardcharttype:coursewiseenrollment', 'block_dashboardchart');
$dashboardcharttype["category"] = get_string('dashboardcharttype:category', 'block_dashboardchart');
$dashboardcharttype["grades"] = get_string('dashboardcharttype:grades', 'block_dashboardchart');
$dashboardcharttype["active_courses"] = get_string('dashboardcharttype:active_courses', 'block_dashboardchart');
if (is_siteadmin($USER->id)) {
$dashboardcharttype["login"] = get_string('dashboardcharttype:login', 'block_dashboardchart');
Expand Down
3 changes: 1 addition & 2 deletions lang/en/block_dashboardchart.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,11 @@
$string['dashboardcharttype:discussionpost'] = 'Forum Discussion Leaderboard';
$string['dashboardcharttype:category'] = 'Courses in category';
$string['dashboardcharttype:login'] = 'Logins per day';
$string['dashboardcharttype:grades'] = 'Show grade';
$string['dashboardcharttype:active_courses'] = 'Most Active courses';
$string['dashboardcharttype:learner_teacher'] = 'Learners and teachers enrolled per category';

$string['earnedgrades'] = 'Earned Grades';
$string['graphtype'] = 'Select preferred Graph type:';
$string['gradedata'] = 'select a course to show grade data';
$string['horizontal'] = 'Horizontal Bar';
$string['leaderboardtypewarning'] = 'Something wrong';
$string['line'] = 'Line Chart';
Expand Down

0 comments on commit 9bfccc6

Please sign in to comment.