From 6ecef85471542bd308d0041e098bd58a7e216455 Mon Sep 17 00:00:00 2001 From: Andrew Cain Date: Wed, 24 May 2023 23:17:18 +1000 Subject: [PATCH] fix: portfolio task list performance --- src/app/common/filters/filters.coffee | 5 +++++ .../tasks/project-tasks-list/project-tasks-list.coffee | 10 ++++++++++ .../project-tasks-list/project-tasks-list.tpl.html | 6 +++--- src/app/units/states/portfolios/portfolios.tpl.html | 8 -------- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/app/common/filters/filters.coffee b/src/app/common/filters/filters.coffee index 7ff6a2ac1..8511c42c2 100644 --- a/src/app/common/filters/filters.coffee +++ b/src/app/common/filters/filters.coffee @@ -246,6 +246,11 @@ angular.module("doubtfire.common.filters", []) ) ) +.filter('tasksForGroupset', -> + (input, groupSet) -> + return input unless input? + return input.filter (task) -> (task.definition.groupSet == groupSet) || (!task.definition.groupSet? && !groupSet?) +) .filter('paginateAndSort', ($filter) -> (input, pagination, tableSort) -> diff --git a/src/app/tasks/project-tasks-list/project-tasks-list.coffee b/src/app/tasks/project-tasks-list/project-tasks-list.coffee index 5c91742bb..5e1dc4fd5 100644 --- a/src/app/tasks/project-tasks-list/project-tasks-list.coffee +++ b/src/app/tasks/project-tasks-list/project-tasks-list.coffee @@ -18,6 +18,16 @@ angular.module('doubtfire.tasks.project-tasks-list', []) controller: ($scope, $modal, newTaskService, analyticsService, gradeService) -> analyticsService.event 'Student Project View', "Showed Task Button List" + $scope.groupTasks = [] + + $scope.groupTasks.push.apply $scope.groupTasks, $scope.unit.groupSets.map (gs) -> + { + groupSet: gs, + name: gs.name + } + + $scope.groupTasks.push {groupSet: null, name: 'Individual Work'} + # functions from task service $scope.statusClass = newTaskService.statusClass $scope.statusText = newTaskService.statusText diff --git a/src/app/tasks/project-tasks-list/project-tasks-list.tpl.html b/src/app/tasks/project-tasks-list/project-tasks-list.tpl.html index 2dbbdbd49..2ef977a13 100644 --- a/src/app/tasks/project-tasks-list/project-tasks-list.tpl.html +++ b/src/app/tasks/project-tasks-list/project-tasks-list.tpl.html @@ -1,7 +1,7 @@