Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvements to Instructor Tools #2266

Merged
merged 25 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
35cf980
imporvements to Instructor Tools
Alex-Jordan Nov 28, 2023
03dfdeb
Implement suggestions made in my review of openwebwork/webwork2#2266
drgrice1 Nov 29, 2023
011bf55
Merge pull request #20 from drgrice1/instructor-tools-suggestions
Alex-Jordan Nov 29, 2023
3a3f9e8
Add more tools to Instructor Tools
Alex-Jordan Nov 30, 2023
5ce2f55
change 370px to 28em for Instructor Tools column width
Alex-Jordan Nov 30, 2023
f6d70e7
Change Instructor Tool form to pills navigation
Alex-Jordan Nov 30, 2023
b2ff4c2
some cleanup
Alex-Jordan Nov 30, 2023
299dd0b
adjust some wording
Alex-Jordan Dec 1, 2023
96f7d25
Style tweaks for the new tabbed layout of the instructor tools input …
drgrice1 Dec 1, 2023
b9c3656
Merge pull request #21 from drgrice1/instructor-tools-tweaks
Alex-Jordan Dec 1, 2023
48726ac
filter users by permission level or role
Alex-Jordan Dec 1, 2023
3aef0da
Efficiency tweak (a significant improvement for large classes).
drgrice1 Dec 1, 2023
32da067
Merge pull request #22 from drgrice1/instructor-tools-efficiency-tweak
Alex-Jordan Dec 1, 2023
90891a4
feedback from PR#2266
Alex-Jordan Dec 1, 2023
237df81
perltidy
Alex-Jordan Dec 1, 2023
cdcbe3a
ability to intersect or union filters
Alex-Jordan Dec 1, 2023
eb4a690
tweak filter radio buttons
Alex-Jordan Dec 1, 2023
9aabb31
More suggestions.
drgrice1 Dec 1, 2023
1d342f4
Merge pull request #23 from drgrice1/instructor-tools-more-tweaks
Alex-Jordan Dec 1, 2023
550ddd7
Between the `md` and `lg` breakpoint, drop out of the horizontal layout
drgrice1 Dec 1, 2023
6cf9147
Add `font-sm` to the union/intersect checkbox labels.
drgrice1 Dec 1, 2023
b7768a2
Also add a small tweak to make the selects on the Answer Log page closer
drgrice1 Dec 1, 2023
b7b296d
Merge pull request #24 from drgrice1/instructor-tools-perhaps
Alex-Jordan Dec 2, 2023
54e3587
update helpfiles where scrolling record list is used
Alex-Jordan Dec 2, 2023
07b04fd
fix indentation in some template files
Alex-Jordan Dec 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions lib/WeBWorK/ContentGenerator/Instructor/Index.pm
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ sub pre_header_initialize ($c) {
} else {
push @error, E_ONE_SET;
}
} elsif (defined $c->param('edit_sets')) {
if ($nsets == 1) {
$route = 'instructor_set_detail';
$args{setID} = $firstSetID;
} else {
push @error, E_ONE_SET;
}
} elsif (defined $c->param('prob_lib')) {
if ($nsets == 1) {
$route = 'instructor_set_maker';
Expand Down Expand Up @@ -153,10 +146,11 @@ sub pre_header_initialize ($c) {
$route = 'instructor_set_detail';
$args{setID} = $firstSetID;
$params{editForUser} = \@selectedUserIDs;
} elsif ($nsets == 1) {
$route = 'instructor_set_detail';
$args{setID} = $firstSetID;
} else {
push @error, E_MIN_ONE_USER unless $nusers >= 1;
push @error, E_ONE_SET unless $nsets == 1;

push @error, E_ONE_SET unless $nsets == 1;
}
} elsif (defined $c->param('create_set')) {
my $setname = format_set_name_internal($c->param('new_set_name') // '');
Expand All @@ -174,6 +168,7 @@ sub pre_header_initialize ($c) {
}
} elsif (defined $c->param('add_users')) {
$route = 'instructor_add_users';
$params{number_of_students} = $c->param('number_of_students') // 1;
} elsif (defined $c->param('email_users')) {
$route = 'instructor_mail_merge';
} elsif (defined $c->param('transfer_files')) {
Expand All @@ -183,7 +178,7 @@ sub pre_header_initialize ($c) {
push @error, x('You are not allowed to act as a student.')
if (defined $c->param('act_as_user') && !$authz->hasPermissions($userID, 'become_student'));
push @error, x('You are not allowed to modify homework sets.')
if ((defined $c->param('edit_sets') || defined $c->param('edit_set_for_users'))
if (defined $c->param('edit_set_for_users')
&& !$authz->hasPermissions($userID, 'modify_problem_sets'));
push @error, x('You are not allowed to assign homework sets.')
if ((defined $c->param('sets_assigned_to_user') || defined $c->param('users_assigned_to_set'))
Expand Down
4 changes: 4 additions & 0 deletions lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
package WeBWorK::ContentGenerator::Instructor::ProblemSetDetail;
use Mojo::Base 'WeBWorK::ContentGenerator', -signatures;

use Exporter qw(import);

=head1 NAME

WeBWorK::ContentGenerator::Instructor::ProblemSetDetail - Edit general set and
Expand All @@ -26,6 +28,8 @@ specific user/set information as well as problem information
use WeBWorK::Utils qw(cryptPassword jitar_id_to_seq seq_to_jitar_id x format_set_name_internal format_set_name_display);
use WeBWorK::Utils::Instructor qw(assignProblemToAllSetUsers addProblemToSet);

our @EXPORT_OK = ('FIELD_PROPERTIES');
Alex-Jordan marked this conversation as resolved.
Show resolved Hide resolved

# These constants determine which fields belong to what type of record.
use constant SET_FIELDS => [
qw(set_header hardcopy_header open_date reduced_scoring_date due_date answer_date visible description
Expand Down
8 changes: 8 additions & 0 deletions lib/WeBWorK/HTML/ScrollingRecordList.pm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ sub scrollingRecordList ($options, @records) {

$sorts = getSortsForClass($class, $options{default_sort});
$formats = getFormatsForClass($class, $options{default_format});
# Remove sorts that are irrelevant for our formats
my @format_keywords;
for my $format (@$formats) {
push(@format_keywords, (split /\W+/, $format->[0]));
}
my $format_keywords = join('|', @format_keywords);
@$sorts = grep { $_->[0] =~ /$format_keywords/ } @$sorts;

$filters = getFiltersForClass(@records);

my @selected_filters;
Expand Down
28 changes: 24 additions & 4 deletions lib/WeBWorK/Utils/FilterRecords.pm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ use warnings;
use Carp;

use WeBWorK::Utils qw(sortByName);
use WeBWorK::ContentGenerator::Instructor::ProblemSetDetail qw/FIELD_PROPERTIES/;

our @EXPORT_OK = qw(
getFiltersForClass
Expand Down Expand Up @@ -79,7 +80,7 @@ sub getFiltersForClass {
my (@records) = @_;

my @filters;
push @filters, [ 'Display all possible records' => 'all', selected => undef ];
push @filters, [ "\x{27E8}Display all possible records\x{27E9}" => 'all', selected => undef ];

if (ref $records[0] eq 'WeBWorK::DB::Record::User') {
my (%sections, %recitations);
Expand All @@ -91,14 +92,33 @@ sub getFiltersForClass {

if (keys %sections > 1) {
for my $sec (sortByName(undef, keys %sections)) {
push @filters, [ ($sec ne '' ? "Display section $sec" : 'Display section <blank>') => "section:$sec" ];
push @filters, [ ($sec ne '' ? "Section: $sec" : 'No Section') => "section:$sec" ];
}
}

if (keys %recitations > 1) {
for my $rec (sortByName(undef, keys %recitations)) {
push @filters,
[ ($rec ne '' ? "Display recitation $rec" : 'Display recitation <blank>') => "recitation:$rec" ];
push @filters, [ ($rec ne '' ? "Recitation: $rec" : 'No Recitation') => "recitation:$rec" ];
}
}
} elsif (ref $records[0] eq 'WeBWorK::DB::Record::Set') {
my (%assignment_types, %visibles);

for my $set (@records) {
++$assignment_types{ $set->assignment_type };
++$visibles{ $set->visible }
unless (defined $visibles{0} && $set->visible eq '' || defined $visibles{''} && $set->visible eq '0');
}

if (keys %assignment_types > 1) {
for my $type (sortByName(undef, keys %assignment_types)) {
push @filters, [ FIELD_PROPERTIES()->{assignment_type}{labels}{$type} => "assignment_type:$type" ];
}
}

if (keys %visibles > 1) {
for my $vis (sortByName(undef, keys %visibles)) {
push @filters, [ ($vis ? 'Visible' : "Not Visible") => "visible:$vis" ];
}
}
}
Expand Down
58 changes: 40 additions & 18 deletions lib/WeBWorK/Utils/FormatRecords.pm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ use warnings;

use Carp;

use WeBWorK::Utils qw/format_set_name_display/;
use WeBWorK::Utils qw/format_set_name_display formatDateTime/;
use WeBWorK::ContentGenerator::Instructor::ProblemSetDetail qw/FIELD_PROPERTIES/;

our @EXPORT_OK = qw(
getFormatsForClass
Expand All @@ -65,16 +66,16 @@ our @EXPORT_OK = qw(
use constant PRESET_FORMATS => {
'WeBWorK::DB::Record::User' => [
[
'uid_lnfn' => {
name => 'user_id - last_name, first_name',
field_order => [qw/user_id last_name first_name/],
format_string => '%s - %s, %s',
'lnfn_email' => {
name => 'last_name, first_name (email_address)',
field_order => [qw/last_name first_name email_address/],
format_string => '%s, %s (%s)',
}
],
[
'lnfn_uid' => {
name => 'last_name, first_name (user_id)',
field_order => [qw/last_name first_name user_id/],
'lnfn_recitation' => {
name => 'last_name, first_name (recitation)',
field_order => [qw/last_name first_name recitation/],
format_string => '%s, %s (%s)',
}
],
Expand All @@ -85,13 +86,6 @@ use constant PRESET_FORMATS => {
format_string => '%s, %s (%s)',
}
],
[
'lnfn_recitation' => {
name => 'last_name, first_name (recitation)',
field_order => [qw/last_name first_name recitation/],
format_string => '%s, %s (%s)',
}
],
[
'lnfn_secrec' => {
name => 'last_name, first_name (section/recitation)',
Expand All @@ -100,14 +94,42 @@ use constant PRESET_FORMATS => {
}
],
[
'lnfn_email' => {
name => 'last_name, first_name (email_address)',
field_order => [qw/last_name first_name email_address/],
'lnfn_uid' => {
name => 'last_name, first_name (user_id)',
field_order => [qw/last_name first_name user_id/],
format_string => '%s, %s (%s)',
}
],
[
'uid_lnfn' => {
name => 'user_id - last_name, first_name',
field_order => [qw/user_id last_name first_name/],
format_string => '%s - %s, %s',
}
],
],
'WeBWorK::DB::Record::Set' => [
[
'type_sid_due' => {
name => 'assignment_type: set_id, due_date',
field_order => [qw/assignment_type set_id due_date/],
format_function => sub {
join('',
FIELD_PROPERTIES()->{assignment_type}{labels}{ $_[0] },
': ', format_set_name_display($_[1]),
', ', formatDateTime($_[2]));
Alex-Jordan marked this conversation as resolved.
Show resolved Hide resolved
}
}
],
[
'due_sid' => {
name => 'due_date: set_id',
field_order => [qw/due_date set_id/],
format_function => sub {
join('', formatDateTime($_[0]), ': ', format_set_name_display($_[1]));
}
}
],
[
'sid' => {
name => 'set_id',
Expand Down
8 changes: 4 additions & 4 deletions lib/WeBWorK/Utils/SortRecords.pm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ use constant PRESET_SORTS => {
'WeBWorK::DB::Record::User' => [
[
'lnfn' => {
name => 'last name, first name',
name => 'last_name, first_name',
fields => [qw/last_name first_name/],
}
],
Expand Down Expand Up @@ -89,9 +89,9 @@ sub getSortsForClass {

my @class_presets = exists PRESET_SORTS->{$class} ? @{ PRESET_SORTS->{$class} } : ();

my @fields = map { [ "Field: $_" => $_, $_ eq $default_sort ? (selected => undef) : () ] } $class->FIELDS;
my @presets = map { [ "Preset: $_->[1]{name}" => $_->[0], $_->[0] eq $default_sort ? (selected => undef) : () ] }
@class_presets;
my @fields = map { [ $_ => $_, $_ eq $default_sort ? (selected => undef) : () ] } $class->FIELDS;
my @presets =
map { [ $_->[1]{name} => $_->[0], $_->[0] eq $default_sort ? (selected => undef) : () ] } @class_presets;

return [ @fields, @presets ];
}
Expand Down
Loading