@@ -22,30 +22,7 @@ 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-
46- if ($c -> current_route eq ' instructor_user_statistics' ) {
47- $c -> {studentID } = $c -> stash(' userID' );
48- } elsif ($c -> current_route =~ / ^instructor_(set|problem)_statistics$ / ) {
25+ if ($c -> current_route =~ / ^instructor_(set|problem)_statistics$ / ) {
4926 my $setRecord = $db -> getGlobalSet($c -> stash(' setID' ));
5027 return unless $setRecord ;
5128 $c -> {setRecord } = $setRecord ;
@@ -57,6 +34,30 @@ sub initialize ($c) {
5734 return unless $problemRecord ;
5835 $c -> {problemRecord } = $problemRecord ;
5936 }
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 =>
46+ [ -and => { not_like => ' set_id:%' }, { not_like => " $ce ->{practiceUserPrefix}\% " } ],
47+ $ce -> {viewable_sections }{$user } || $ce -> {viewable_recitations }{$user }
48+ ? (
49+ -or => [
50+ $ce -> {viewable_sections }{$user } ? (section => $ce -> {viewable_sections }{$user }) : (),
51+ $ce -> {viewable_recitations }{$user }
52+ ? (recitation => $ce -> {viewable_recitations }{$user })
53+ : ()
54+ ]
55+ )
56+ : ()
57+ },
58+ [qw/ last_name first_name user_id/ ]
59+ )
60+ ];
6061 }
6162
6263 return ;
@@ -67,9 +68,7 @@ sub page_title ($c) {
6768
6869 my $setID = $c -> stash(' setID' ) || ' ' ;
6970
70- if ($c -> current_route eq ' instructor_user_statistics' ) {
71- return $c -> maketext(' Statistics for student [_1]' , $c -> {studentID });
72- } elsif ($c -> current_route eq ' instructor_set_statistics' ) {
71+ if ($c -> current_route eq ' instructor_set_statistics' ) {
7372 return $c -> maketext(' Statistics for [_1]' , $c -> tag(' span' , dir => ' ltr' , format_set_name_display($setID )));
7473 } elsif ($c -> current_route eq ' instructor_problem_statistics' ) {
7574 return $c -> maketext(
@@ -79,12 +78,11 @@ sub page_title ($c) {
7978 );
8079 }
8180
82- return $c -> maketext(' Statistics' );
81+ return $c -> maketext(' Set Statistics' );
8382}
8483
8584sub siblings ($c ) {
86- # Stats and StudentProgress share this template.
87- return $c -> include(' ContentGenerator/Instructor/Stats/siblings' , header => $c -> maketext(' Statistics' ));
85+ return $c -> include(' ContentGenerator/Instructor/Stats/siblings' );
8886}
8987
9088# Apply the currently selected filter to the student records, and return a reference to the
0 commit comments