@@ -22,27 +22,6 @@ sub initialize ($c) {
2222 # Check permissions
2323 return unless $c -> authz-> hasPermissions($user , ' access_instructor_tools' );
2424
25- # Cache a list of all users except set level proctors and practice users, and restrict to the sections or
26- # recitations that are allowed for the user if such restrictions are defined. This list is sorted by last_name,
27- # then first_name, then user_id. This is used in multiple places in this module, and is guaranteed to be used at
28- # least once. So it is done here to prevent extra database access.
29- $c -> {student_records } = [
30- $db -> getUsersWhere(
31- {
32- user_id => [ -and => { not_like => ' set_id:%' }, { not_like => " $ce ->{practiceUserPrefix}\% " } ],
33- $ce -> {viewable_sections }{$user } || $ce -> {viewable_recitations }{$user }
34- ? (
35- -or => [
36- $ce -> {viewable_sections }{$user } ? (section => $ce -> {viewable_sections }{$user }) : (),
37- $ce -> {viewable_recitations }{$user } ? (recitation => $ce -> {viewable_recitations }{$user }) : ()
38- ]
39- )
40- : ()
41- },
42- [qw/ last_name first_name user_id/ ]
43- )
44- ];
45-
4625 if ($c -> current_route =~ / ^instructor_(set|problem)_statistics$ / ) {
4726 my $setRecord = $db -> getGlobalSet($c -> stash(' setID' ));
4827 return unless $setRecord ;
@@ -55,6 +34,27 @@ sub initialize ($c) {
5534 return unless $problemRecord ;
5635 $c -> {problemRecord } = $problemRecord ;
5736 }
37+
38+ # Cache a list of all users except set level proctors and practice users, and restrict to the sections
39+ # or recitations that are allowed for the user if such restrictions are defined. This list is sorted by
40+ # last_name, then first_name, then user_id. This is used in multiple places in this module, and is used
41+ # on every page except the main page, so it is done here to prevent extra database access.
42+ $c -> {student_records } = [
43+ $db -> getUsersWhere(
44+ {
45+ user_id => [ -and => { not_like => ' set_id:%' }, { not_like => " $ce ->{practiceUserPrefix}\% " } ],
46+ $ce -> {viewable_sections }{$user } || $ce -> {viewable_recitations }{$user }
47+ ? (
48+ -or => [
49+ $ce -> {viewable_sections }{$user } ? (section => $ce -> {viewable_sections }{$user }) : (),
50+ $ce -> {viewable_recitations }{$user } ? (recitation => $ce -> {viewable_recitations }{$user }) : ()
51+ ]
52+ )
53+ : ()
54+ },
55+ [qw/ last_name first_name user_id/ ]
56+ )
57+ ];
5858 }
5959
6060 return ;
@@ -79,8 +79,7 @@ sub page_title ($c) {
7979}
8080
8181sub siblings ($c ) {
82- # Stats and StudentProgress share this template.
83- return $c -> include(' ContentGenerator/Instructor/Stats/siblings' , header => $c -> maketext(' Statistics' ));
82+ return $c -> include(' ContentGenerator/Instructor/Stats/siblings' );
8483}
8584
8685# Apply the currently selected filter to the student records, and return a reference to the
0 commit comments