Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2d33b9e
Change .gitignore to ignore the bower_components directory
pstaabp Mar 19, 2014
9aa9d73
Change the comments in the OPL-update file to reflect where the libra…
pstaabp Mar 19, 2014
c68f577
Merge branch 'develop' into ww3-feature/reduced_credit
pstaabp May 18, 2014
6587106
Merge branch 'reduced_credit_date' of https://github.com/goehle/webwo…
pstaabp May 18, 2014
c9c8c48
Initial work on reduced_credit in WW3
pstaabp May 18, 2014
4dd0660
Initial work done to include Reduced Scoring in WW3
pstaabp May 19, 2014
66fbac0
Fixed a bug in which the yes/no or 0/1 needed to be changed to "0"/"1"
pstaabp May 19, 2014
af44950
Show/Hide Reduced Scoring info based on global setting
pstaabp May 19, 2014
b6c43b6
Added dynamic reduced credit scoring date to the Problem details
pstaabp May 20, 2014
3bf3e27
calendar fixes
pstaabp May 20, 2014
4a2de4c
Reduced Credit dates now appear on the calendar.
pstaabp May 21, 2014
6ae69c7
Added the ability to show/hide individual types of assignments.
pstaabp May 21, 2014
0806285
Added Reduced Scoring to the Problem Set Detail View/ Customize to us…
pstaabp May 21, 2014
2dce1cb
Added reduced scoring to the customize users view of the Problem Set …
pstaabp May 22, 2014
5cca4e2
Validation of all dates in a ProblemSet and improved messaging on err…
pstaabp May 22, 2014
c8a43ca
Merge branch 'ww3' of https://github.com/openwebwork/webwork2 into ww…
pstaabp May 22, 2014
635f88a
Removed a duplicated setting and improved the handling of a new reduc…
pstaabp May 22, 2014
3a4378f
Changed the documentation setting for the reduced_scoring_period.
pstaabp May 30, 2014
5656d7d
If reduced_scoring is not set, the field in the Problem Set Manager i…
pstaabp May 30, 2014
9dadf8c
For setting dates, all dates via the date picker, adjust so that ther…
pstaabp May 30, 2014
0d59f18
restored click on set name in Problem Set Manager goes to Problem Set…
pstaabp May 30, 2014
3613f92
Added month and year selector to date picker.
pstaabp May 30, 2014
35f2723
Merge branch 'ww3-feature/true-false-issue' into ww3-feature/reduced_…
pstaabp Jun 3, 2014
5bd25eb
Calendar now shows/hides the "Show Reduced Scoring Dates" in the pull…
pstaabp Jun 3, 2014
33252ad
Show/hide reduced scoring dates when applicable. Before it hide the …
pstaabp Jun 3, 2014
4bbc2b0
Changed Problem Set Manager and Problem Set Details page to include t…
pstaabp Jun 3, 2014
caf3397
Changed the way the userSets was handled on the server.
pstaabp Jun 3, 2014
1e7aff3
Changed some default settings and some code cleanup.
pstaabp Jun 3, 2014
33a4446
Fixes to strangeness in the reduced scoring in problem sets.
pstaabp Jun 5, 2014
71d82f6
send back the _id field so that the client knows that the returned da…
pstaabp Jun 9, 2014
3d72433
Fixed bug where set properties with booleans weren't saving correctly.
pstaabp Jun 10, 2014
9cbdf22
Fixed another case of the boolean settings not being stored correctly.
pstaabp Jun 10, 2014
09f589e
Fixed another case of the boolean settings not being stored correctly.
pstaabp Jun 10, 2014
ef2a607
deleted some debug statements.
pstaabp Jun 10, 2014
534c1ba
Fixed the Problem Set Details View (and customize users) to show/hide…
pstaabp Jun 11, 2014
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ courses.dist
library-directory-tree.json
library-subject-tree.json
textbook-tree.json
development.yml
production.yml
*~
!tmp/README
!htdocs/tmp/README
4 changes: 2 additions & 2 deletions bin/OPL-update
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# 1) The OPL downloaded to your machine (the .pg files)
# 2) The environment variable WEBWORK_ROOT needs to be
# correctly defined (as with other scripts here).
# 3) Configuration for the OPL in site.conf needs to be
# 3) Configuration for the OPL in localOverrides.conf needs to be
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a documentation error; nothing to do with reduced scoring, but needed to be fixed.

# done (basically just setting the path to the OPL files).

#use strict;
Expand Down Expand Up @@ -406,7 +406,7 @@ if(open(IN, "$libraryRoot/Textbooks")) {
close(IN);
} else {
print "Textbooks file was not found in library $libraryRoot. If the path to the problem library doesn't seem
correct, make modifications in webwork2/conf/site.conf (\$problemLibrary{root}). If that is correct then
correct, make modifications in webwork2/conf/localOverrides.conf (\$problemLibrary{root}). If that is correct then
updating from git should download the Textbooks file.\n";
}
#### End of textbooks
Expand Down
50 changes: 25 additions & 25 deletions conf/defaults.config
Original file line number Diff line number Diff line change
Expand Up @@ -1356,15 +1356,15 @@ $ConfigValues = [
type => 'popuplist'
},
{ var => 'pg{specialPGEnvironmentVars}{DragMath}',
doc => 'Use DragMath editor for answer entry',
doc2 => 'Set to true to display pencil DragMath equation editor next to each answer box',
type => 'boolean'
},
{ var => 'pg{specialPGEnvironmentVars}{MathView}',
doc => 'Use MathView editor for answer entry',
doc2 => 'Set to true to display MathView equation editor icon next to each answer box',
type => 'boolean'
},
doc => 'Use DragMath editor for answer entry',
doc2 => 'Set to true to display pencil DragMath equation editor next to each answer box',
type => 'boolean'
},
{ var => 'pg{specialPGEnvironmentVars}{MathView}',
doc => 'Use MathView editor for answer entry',
doc2 => 'Set to true to display MathView equation editor icon next to each answer box',
type => 'boolean'
},
{ var => 'pg{options}{showEvaluatedAnswers}',
doc => 'Display the evaluated student answer',
doc2 => 'Set to true to display the "Entered" column which automatically shows the evaluated student answer, e.g. 1 if student input is sin(pi/2). If this is set to false, e.g. to save space in the response area, the student can still see their evaluated answer by hovering the mouse pointer over the typeset version of their answer.',
Expand Down Expand Up @@ -1399,7 +1399,7 @@ $ConfigValues = [
type => boolean
},
{ var => 'pg{ansEvalDefaults}{reducedScoringPeriod}',
doc => 'Length of Reduced Scoring Period in minutes',
doc => 'Default Length of the Reduced Scoring Period',
doc2 => 'The Reduced Scoring Period is a period before the due date during which all additional work done by the student counts at a reduced rate. Here is where you set the default length of this period in minutes. This sets the default Reduced Scoring date, which can be changed on a per set basis. If the Reduced Scoring is enabled and if it is after the reduced scoring date, but before the due date, a message like "This assignment has a Reduced Scoring Period that begins 11/08/2009 at 06:17pm EST and ends on the due date, 11/10/2009 at 06:17pm EST. During this period all additional work done counts 50% of the original." will be displayed.' ,
type => 'number'
},
Expand Down Expand Up @@ -1428,32 +1428,32 @@ $ConfigValues = [
values => [qw(1 0.95 0.9 0.85 0.8 0.75 0.7 0.65 0.6 0.55 0.5 0.45 0.4 0.35 0.3 0.25 0.2 0.15 0.1)],
type => 'popuplist'
},
{ var => 'pg{timeAssignDue}',
{ var => 'pg{timeAssignDue}',
doc => 'Time that the Assignment is Due',
doc2 => 'The time of the day that the assignment is due. This can be changed on an individual basis, but WeBWorK will use this value for default when a date is set.',
type => 'text'
},
{ var => 'pg{assignOpenPriorToDue}',
doc => 'Amount of Time (in minutes) before Due Date that the Assignment is Open',
doc2 => 'The amount of time (in minutes) before the due date when the assignment is opened.',
type => 'number'
doc2 => 'The amount of time (in minutes) before the due date when the assignment is opened.',
type => 'number'
},
{ var => 'pg{answersOpenAfterDueDate}',
doc => 'Amount of Time (in minutes) after Due Date that Answers are Open',
doc2 => 'The amount of time (in minutes) after the due date that the Answers are available to student to view.',
type => 'number'
type => 'number'
},
{ var => 'pg{options}{enableShowMeAnother}',
doc => 'Enable Show Me Another button',
doc2 => 'Enables use of the Show Me Another button, which offers the student a newly-seeded version of the current problem, complete with solution (if it exists for that problem).',
type => 'boolean'
},
{ var => 'pg{options}{showMeAnotherMaxReps}',
doc => 'Maximum times Show me Another can be used per problem (-1 => unlimited)',
doc2 => 'The Maximum number of times Show me Another can be used per problem by a student. If set to -1 then there is no limit to the number of times that Show Me Another can be used.',
type => 'number'
},
{ var => 'pg{options}{showMeAnother}',
{ var => 'pg{options}{enableShowMeAnother}',
doc => 'Enable Show Me Another button',
doc2 => 'Enables use of the Show Me Another button, which offers the student a newly-seeded version of the current problem, complete with solution (if it exists for that problem).',
type => 'boolean'
},
{ var => 'pg{options}{showMeAnotherMaxReps}',
doc => 'Maximum times Show me Another can be used per problem (-1 => unlimited)',
doc2 => 'The Maximum number of times Show me Another can be used per problem by a student. If set to -1 then there is no limit to the number of times that Show Me Another can be used.',
type => 'number'
},
{ var => 'pg{options}{showMeAnother}',
doc => 'List of options for Show Me Another button',
doc2 => '<ul><li><b>SMAcheckAnswers</b>: enables the Check Answers button <i>for the new problem</i> when Show Me Another is clicked</li> <li><b>SMAshowSolutions</b>: shows walk-through solution <i>for the new problem</i> when Show Me Another is clicked; a check is done first to make sure that a solution exists </li><li><b>SMAshowCorrect</b>: correct answers <i>for the new problem</i> can be viewed when Show Me Another is clicked; note that <b>SMAcheckAnswers</b> needs to be enabled at the same time</li><li><b>SMAshowHints</b>: show hints <i>for the new problem</i> (assuming they exist)</li></ul>Note: there is very little point enabling the button unless you check at least one of these options - the students would simply see a new version that they can not attempt or learn from.</p>',
min => 0,
Expand Down
8 changes: 4 additions & 4 deletions webwork3/bin/app.pl
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

hook 'before' => sub {

for my $key (keys(%{request->params})){
my $value = defined(params->{$key}) ? params->{$key} : '';
debug($key . " : " . $value);
}
# for my $key (keys(%{request->params})){
# my $value = defined(params->{$key}) ? params->{$key} : '';
# debug($key . " : " . $value);
# }

};

Expand Down
38 changes: 18 additions & 20 deletions webwork3/lib/Routes/ProblemSets.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ package ProblemSets;
use strict;
use warnings;
use Dancer ':syntax';
use Utils::Convert qw/convertObjectToHash convertArrayOfObjectsToHash/;
use Utils::Convert qw/convertObjectToHash convertArrayOfObjectsToHash convertBooleans/;
use Utils::ProblemSets qw/reorderProblems addGlobalProblems addUserSet addUserProblems deleteProblems createNewUserProblem/;
use WeBWorK::Utils qw/parseDateTime decodeAnswers/;
use Array::Utils qw(array_minus);
use Routes::Authentication qw/checkPermissions setCourseEnvironment/;
use Utils::CourseUtils qw/getCourseSettings/;
use Dancer::Plugin::Database;
use Dancer::Plugin::Ajax;
use List::Util qw(first max );
use List::Util qw/first max/;

our @set_props = qw/set_id set_header hardcopy_header open_date due_date answer_date visible enable_reduced_scoring assignment_type attempts_per_version time_interval versions_per_interval version_time_limit version_creation_time version_last_attempt_time problem_randorder hide_score hide_score_by_problem hide_work time_limit_cap restrict_ip relax_restrict_ip restricted_login_proctor/;
our @user_set_props = qw/user_id set_id psvn set_header hardcopy_header open_date due_date answer_date visible enable_reduced_scoring assignment_type description restricted_release restricted_status attempts_per_version time_interval versions_per_interval version_time_limit version_creation_time problem_randorder version_last_attempt_time problems_per_page hide_score hide_score_by_problem hide_work time_limit_cap restrict_ip relax_restrict_ip restricted_login_proctor hide_hint/;
our @set_props = qw/set_id set_header hardcopy_header open_date reduced_scoring_date due_date answer_date visible enable_reduced_scoring assignment_type attempts_per_version time_interval versions_per_interval version_time_limit version_creation_time version_last_attempt_time problem_randorder hide_score hide_score_by_problem hide_work time_limit_cap restrict_ip relax_restrict_ip restricted_login_proctor/;
our @user_set_props = qw/user_id set_id psvn set_header hardcopy_header open_date reduced_scoring_date due_date answer_date visible enable_reduced_scoring assignment_type description restricted_release restricted_status attempts_per_version time_interval versions_per_interval version_time_limit version_creation_time problem_randorder version_last_attempt_time problems_per_page hide_score hide_score_by_problem hide_work time_limit_cap restrict_ip relax_restrict_ip restricted_login_proctor hide_hint/;
our @problem_props = qw/problem_id flags value max_attempts source_file/;
our @boolean_set_props = qw/visible enable_reduced_scoring/;

Expand Down Expand Up @@ -132,19 +132,16 @@ put '/courses/:course_id/sets/:set_id' => sub {

####
#
# Set up the global set for either a add (if new) or put (if old)
# set all the parameters sent from the client as new properties.
#
##

my %allparams = params;
my $set = vars->{db}->getGlobalSet(params->{set_id});

for my $key (@set_props) {
$set->{$key} = params->{$key} if defined(params->{$key});
my $setFromClient = convertBooleans(\%allparams,\@boolean_set_props);
for my $key (@set_props){
$set->{$key} = $setFromClient->{$key};
}


vars->{db}->putGlobalSet($set);

my $result = vars->{db}->putGlobalSet($set);

##
#
Expand All @@ -155,7 +152,6 @@ put '/courses/:course_id/sets/:set_id' => sub {
my @userNamesFromDB = vars->{db}->listSetUsers(params->{set_id});
my @usersToAdd = array_minus(@{params->{assigned_users}},@userNamesFromDB);
my @usersToDelete = array_minus(@userNamesFromDB,@{params->{assigned_users}});
my @test2 = grep{ not $_ ~~ @userNamesFromDB } @{params->{assigned_users}};

for my $user(@usersToAdd){
addUserSet($user,params->{set_id});
Expand All @@ -180,18 +176,21 @@ put '/courses/:course_id/sets/:set_id' => sub {

addUserProblems(params->{set_id},params->{problems},params->{assigned_users});

## why is this here? it doesn't do anything.

if (scalar(@usersToDelete)>0){
debug "Deleting users to set " . params->{set_id};
debug join("; ", @usersToDelete);
}

my $setFromDB = vars->{db}->getGlobalSet(params->{set_id});

my $returnSet = convertObjectToHash($set,\@boolean_set_props);
my $returnSet = convertObjectToHash($setFromDB,\@boolean_set_props);


$returnSet->{assigned_users} = params->{assigned_users};
$returnSet->{problems} = convertArrayOfObjectsToHash(\@globalProblems);
$returnSet->{_id} = params->{set_id};

return $returnSet;

Expand Down Expand Up @@ -495,14 +494,13 @@ put '/courses/:course_id/users/:user_id/sets/:set_id' => sub {

for my $key (@user_set_props) {
my $globalValue = $globalSet->{$key} || "";
# debug $key . " : " . $globalValue . " : " . params->{$key};
# check to see if the value differs from the global value. If so, set it.
$userSet->{$key} = params->{$key}
if ((defined(params->{$key}) && $globalValue ne params->{$key}) || $key eq "psvn" || $key eq "user_id");
# check to see if the value differs from the global value. If so, set it else delete it.
$userSet->{$key} = params->{$key} if defined(params->{$key});
delete $userSet->{$key} if $globalValue eq $userSet->{$key} && $key ne "set_id";

}
vars->{db}->putUserSet($userSet);


return convertObjectToHash(vars->{db}->getMergedSet(params->{user_id},params->{set_id}),\@boolean_set_props);
};

Expand Down
16 changes: 10 additions & 6 deletions webwork3/lib/Routes/Settings.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,20 @@ get '/courses/:course_id/settings/:setting_id' => sub {

put '/courses/:course_id/settings/:setting_id' => sub {

debug session;

if(session->{permission} < 10){send_error($PERMISSION_ERROR,403)}

debug "in PUT /course/:course_id/settings/:setting_id";

#debug "in PUT /course/:course_id/settings/:setting_id";
my $ConfigValues = getCourseSettingsWW2();
foreach my $oneConfig (@$ConfigValues) {
foreach my $hash (@$oneConfig) {
if (ref($hash)=~/HASH/){
if ($hash->{var} eq params->{setting_id}){
$hash->{value} = params->{value};
if($hash->{type} eq 'boolean'){
$hash->{value} = params->{value} ? 1 : 0;
} else {
$hash->{value} = params->{value};
}
return writeConfigToFile(vars->{ce},$hash);
}
}
Expand Down Expand Up @@ -161,7 +163,6 @@ sub writeConfigToFile {
chomp $line;
if ($line =~ /^\$/) {
my ($var,$value) = ($line =~ /^\$(.*)\s+=\s+(.*);$/);
debug $var;
if ($var eq $config->{var}){
$fileoutput .= writeLine($config->{var},$config->{value});
$varFound = 1;
Expand Down Expand Up @@ -192,6 +193,9 @@ sub writeConfigToFile {
if ($writeFileErrors){
return {error=>$writeFileErrors};
} else {
if($config->{type} eq 'boolean'){
$config->{value} = $config->{value} ? JSON::true : JSON::false;
}
return $config;
}
}
Expand Down
14 changes: 13 additions & 1 deletion webwork3/lib/Utils/Convert.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
package Utils::Convert;
use base qw(Exporter);
use JSON;
use Data::Dumper;
our @EXPORT = ();
our @EXPORT_OK = qw(convertObjectToHash convertArrayOfObjectsToHash);
our @EXPORT_OK = qw(convertObjectToHash convertArrayOfObjectsToHash convertBooleans);


## This converts an array of objects to an array of Hashes
Expand Down Expand Up @@ -38,4 +39,15 @@ sub convertObjectToHash {
return $s;
}

sub convertBooleans {
my ($obj,$boolean_props) = @_;

for my $key (@{$boolean_props}){
$obj->{$key} = $obj->{$key} ? 1: 0;
}

return $obj;
}


return 1;
2 changes: 1 addition & 1 deletion webwork3/public/css/course-manager.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ a#view-header i {margin-left:1ex;}

.set-not-visible {font-style: italic;}
.set-visible {font-weight: bold;}
.set-reduced-credit {color: rgb(217,115,52);}
.set-reduced-scoring {color: rgb(217,115,52);}

.assign-set-name {cursor: pointer;}

Expand Down
4 changes: 3 additions & 1 deletion webwork3/public/css/webwork.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ body { /* needed for the navigation bars top and bottom*/

.sortable-placeholder {border: 1px solid black; background-color: lightyellow;}

.ui-datepicker {z-index: 1200 !important;} /* To ensure that it floats above the nav bar */

/* a wwdate is generally an input and we want to make it look like a span */

.wwdate { width: auto; border: none;}
Expand Down Expand Up @@ -76,7 +78,7 @@ border-top: solid 1px rgb(220, 220, 220);}
.assign-open {background-color: lightgreen;}
.assign-due {background-color: red;}

.assign-reduced-credit {background-color: rgb(255,128,0);}
.assign-reduced-scoring {background-color: rgb(255,128,0);}

.assign-not-visible {background-color: darkgray;}

Expand Down
Loading