Skip to content

Commit

Permalink
fix: portfolio task list performance
Browse files Browse the repository at this point in the history
  • Loading branch information
macite committed May 24, 2023
1 parent c5ac95b commit 6ecef85
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
5 changes: 5 additions & 0 deletions src/app/common/filters/filters.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand Down
10 changes: 10 additions & 0 deletions src/app/tasks/project-tasks-list/project-tasks-list.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/app/tasks/project-tasks-list/project-tasks-list.tpl.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ul class="project-tasks-list">
<div ng-repeat="(groupSetId, relatedTasks) in project.tasks | groupBy: 'definition.groupSet.id'" class="group-set-tasks clearfix">
<h5 class="group-set-name" ng-hide="hideGroupSetName">{{groupSetName(groupSetId)}}</h5>
<li class="col-xs-4 col-lg-3" ng-repeat="task in relatedTasks | orderBy: ['definition.targetGrade','definition.seq']">
<div ng-repeat="grouping in groupTasks" class="group-set-tasks clearfix">
<h5 class="group-set-name" ng-hide="hideGroupSetName">{{grouping.name}}</h5>
<li class="col-xs-4 col-lg-3" ng-repeat="task in project.tasks | tasksForGroupset: grouping.groupSet | orderBy: ['definition.targetGrade','definition.seq']">
<button type="button" class="col-xs-12 btn task-status {{statusClass(task.status)}}" ng-click="onSelect(task, 'Task Button List')" tooltip-popup-delay='200' tooltip-placement="bottom" tooltip-html-unsafe="<strong>{{task.definition.name}}:</strong><br>{{task.statusLabel()}}">
<i class="fa fa-eye" ng-show="task.similarToCount - task.similarToDismissedCount > 0"></i> {{taskText(task)}}
</button>
Expand Down
8 changes: 0 additions & 8 deletions src/app/units/states/portfolios/portfolios.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ <h4 class="panel-title" ng-hide="selectedStudent">Portfolio Details</h4>
<div class="panel-heading clearfix">
<div class="pull-left">
<h3 class="panel-title">Review Progress of {{selectedStudent.student.name}}</h3>
<!--/title-->
Review the students progress through the unit's tasks.
</div>
</div>
Expand All @@ -230,7 +229,6 @@ <h3 class="panel-title">Review Progress of {{selectedStudent.student.name}}</h3>
<div class="panel-heading clearfix">
<div class="pull-left">
<h3 class="panel-title">Review Portfolio of {{selectedStudent.student.name}}</h3>
<!--/title-->
View or download portfolio for assessment.
</div>
</div>
Expand Down Expand Up @@ -266,12 +264,6 @@ <h4 class="panel-title">Grade for {{selectedStudent.student.name}}</h4>
<div class="small" ng-hide="project.gradeRationale">Click to add one</div>
</div>
<div ng-if="editingRationale" class="clearfix">
<!-- <markdown-editor
height="200"
ng-model="project.gradeRationale"
placeholder="Edit rationale..."
autofocus="true">
</markdown-editor> -->
<div
contenteditable
ng-model="project.gradeRationale"
Expand Down

0 comments on commit 6ecef85

Please sign in to comment.