Skip to content

Commit

Permalink
SAK-33102 copy sort order in GBNG (sakaiproject#5801)
Browse files Browse the repository at this point in the history
* SAK-33102 copy sort order in GBNG

* Revert "SAK-33102 copy sort order in GBNG"

This reverts commit ef5fe9d.

* SAK-33102
  • Loading branch information
RyanAFinney authored and ern committed Sep 25, 2018
1 parent 4bf16bf commit 8d135b4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,24 @@ public List<Assignment> getGradebookAssignments(final SortType sortBy) {
* @return a list of assignments or empty list if none/no gradebook
*/
public List<Assignment> getGradebookAssignmentsForStudent(final String studentUuid) {
return getGradebookAssignmentsForStudent(studentUuid, SortType.SORT_BY_SORTING);
}

/**
* Special operation to get a list of assignments in the gradebook that the specified student has access to. This taked into account
* externally defined assessments that may have grouping permissions applied.
*
* This should only be called if you are wanting to view the assignments that a student would see (ie if you ARE a student, or if you
* are an instructor using the student review mode)
*
* Define the sortedBy to return these assignments back in the desired order.
*
* @return a list of assignments or empty list if none/no gradebook
*/
public List<Assignment> getGradebookAssignmentsForStudent(final String studentUuid, final SortType sortedBy) {

final Gradebook gradebook = getGradebook(getCurrentSiteId());
final List<Assignment> assignments = getGradebookAssignments();
final List<Assignment> assignments = getGradebookAssignments(sortedBy);

// NOTE: cannot do a role check here as it assumes the current user but this could have been called by an instructor (unless we add
// a new method to handle this)
Expand All @@ -410,8 +425,8 @@ public List<Assignment> getGradebookAssignmentsForStudent(final String studentUu
final Assignment a = iter.next();
if (a.isExternallyMaintained()) {
if (this.gradebookExternalAssessmentService.isExternalAssignmentGrouped(gradebook.getUid(), a.getExternalId()) &&
!this.gradebookExternalAssessmentService.isExternalAssignmentVisible(gradebook.getUid(), a.getExternalId(),
studentUuid)) {
!this.gradebookExternalAssessmentService.isExternalAssignmentVisible(gradebook.getUid(), a.getExternalId(),
studentUuid)) {
iter.remove();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.sakaiproject.service.gradebook.shared.CategoryDefinition;
import org.sakaiproject.service.gradebook.shared.CourseGrade;
import org.sakaiproject.service.gradebook.shared.GradingType;
import org.sakaiproject.service.gradebook.shared.SortType;
import org.sakaiproject.tool.gradebook.Gradebook;

public class InstructorGradeSummaryGradesPanel extends BasePanel {
Expand Down Expand Up @@ -81,7 +82,8 @@ public void onBeforeRender() {

// build the grade matrix for the user
final Gradebook gradebook = getGradebook();
final List<Assignment> assignments = this.businessService.getGradebookAssignmentsForStudent(userId);
final SortType sortedBy = this.isGroupedByCategory ? SortType.SORT_BY_CATEGORY : SortType.SORT_BY_SORTING;
final List<Assignment> assignments = this.businessService.getGradebookAssignmentsForStudent(userId, sortedBy);

final boolean isCourseGradeVisible = this.businessService.isCourseGradeVisible(this.businessService.getCurrentUser().getId());
final GbRole userRole = gradebookPage.getCurrentRole();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.sakaiproject.service.gradebook.shared.CategoryScoreData;
import org.sakaiproject.service.gradebook.shared.CourseGrade;
import org.sakaiproject.service.gradebook.shared.GradingType;
import org.sakaiproject.service.gradebook.shared.SortType;
import org.sakaiproject.tool.gradebook.Gradebook;

/**
Expand Down Expand Up @@ -94,7 +95,8 @@ public void onBeforeRender() {

// build up table data
final Map<Long, GbGradeInfo> grades = this.businessService.getGradesForStudent(userId);
final List<Assignment> assignments = this.businessService.getGradebookAssignmentsForStudent(userId);
final SortType sortedBy = this.isGroupedByCategory ? SortType.SORT_BY_CATEGORY : SortType.SORT_BY_SORTING;
final List<Assignment> assignments = this.businessService.getGradebookAssignmentsForStudent(userId, sortedBy);

final List<String> categoryNames = new ArrayList<>();
final Map<String, List<Assignment>> categoryNamesToAssignments = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,7 @@ GradebookGradeSummary.prototype.setupTableSorting = function() {
stickyHeaders_yScroll : null,
stickyHeaders_filteredToTop: true
},
//sort by due date descending and secondarily by assignment title
sortList: [[3, 0], [0, 0]],
sortReset : true,
textExtraction: function(node) {
var $node = $(node);
// sort dates by data-sort-key
Expand Down

0 comments on commit 8d135b4

Please sign in to comment.