Skip to content

Commit affcb52

Browse files
committed
No group mode: edit form and statistics data table fixed
1 parent c3c694c commit affcb52

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

assignment.class.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ private function init_permission() {
116116
}
117117

118118
// view edit
119+
if ($this->group->mode == NOGROUPS) {
120+
$this->capability['view'] = true;
121+
$this->capability['edit'] = true;
122+
}
119123
}
120124

121125
/**
@@ -291,8 +295,13 @@ private function save_repo($repo = null, $github_info) {
291295
private function edit_form($repo = null) {
292296
global $PAGE, $USER;
293297

294-
// Group mode, check permission
295-
if (($this->capability['view'] && !$this->capability['edit']) || !$this->group->id || !$this->isopen()) {
298+
// check assignment status and user permission
299+
if (!$this->isopen() || !$this->capability['edit']) {
300+
return $this->show_repo($repo);
301+
}
302+
303+
// Group mode, check permission and groupid
304+
if ($this->group->mode && (!$this->capability['view'] || !$this->group->id)) {
296305
return $this->show_repo($repo);
297306
}
298307

modules/git_logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function get_statistics_by_user($userid) {
7575
}
7676

7777
$sql = "SELECT
78-
userid, author, COUNT(*) AS commits, SUM(files) AS files,
78+
userid, author, email, COUNT(*) AS commits, SUM(files) AS files,
7979
SUM(insertions) AS insertions, SUM(deletions) AS deletions,
8080
SUM(insertions)+SUM(deletions) AS total
8181
FROM `{$CFG->prefix}{$this->_table}`

0 commit comments

Comments
 (0)