Skip to content

Commit 75b7135

Browse files
author
mschmitt
committed
Tweak to make filters fail gracefully
git-svn-id: http://svn.webwork.maa.org/system/trunk/webwork2@2198 c0722133-6baf-4dd8-8699-98d999cd4f06
1 parent d6e88e2 commit 75b7135

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lib/WeBWorK/ContentGenerator/Instructor/Assigner.pm

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
################################################################################
22
# WeBWorK Online Homework Delivery System
33
# Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/
4-
# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/Assigner.pm,v 1.20 2004/04/05 03:56:05 sh002i Exp $
4+
# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/Assigner.pm,v 1.21 2004/05/24 01:43:36 mschmitt Exp $
55
#
66
# This program is free software; you can redistribute it and/or modify it under
77
# the terms of either: (a) the GNU General Public License as published by the
@@ -53,17 +53,19 @@ sub body {
5353
{@viewable_sections = @{$ce->{viewable_sections}->{$user}};}
5454
if (defined @{$ce->{viewable_recitations}->{$user}})
5555
{@viewable_recitations = @{$ce->{viewable_recitations}->{$user}};}
56-
foreach my $student (@Users){
57-
my $keep = 0;
58-
foreach my $sec (@viewable_sections){
59-
if ($student->section() eq $sec){$keep = 1;}
60-
}
61-
foreach my $rec (@viewable_recitations){
62-
if ($student->section() eq $rec){$keep = 1;}
56+
if (@viewable_sections or @viewable_recitations){
57+
foreach my $student (@Users){
58+
my $keep = 0;
59+
foreach my $sec (@viewable_sections){
60+
if ($student->section() eq $sec){$keep = 1;}
61+
}
62+
foreach my $rec (@viewable_recitations){
63+
if ($student->section() eq $rec){$keep = 1;}
64+
}
65+
if ($keep) {push @myUsers, $student;}
6366
}
64-
if ($keep) {push @myUsers, $student;}
67+
@Users = @myUsers;
6568
}
66-
@Users = @myUsers;
6769
## End Mark's Edits
6870

6971

0 commit comments

Comments
 (0)