WeBWorK Problems

File upload

File upload

by Steven Fiedler -
Number of replies: 9

I'm seeking to design a process where students would be incentivized to not change values that they collect as data in a lab course. My initial thought was to require students to upload photos of their data entry sheets, after which they would be granted access to the experiment's webwork assignment. Unfortunately, it doesn't appear that WeBWorK presently has the functionality to receive student file uploads. In this linked forum response, Glenn Rice suggested that students could attach a file with the e-mail instructor option. If an internal parameter could be triggered by such an action and could be access via pg, perhaps conditional access to the assignment could be automated.

Also, in principle, instructors can collect carbon copies pages containing raw student data, but I'm trying to avoid creating a great deal of paper waste. This question is a bit broad, but I would be appreciative if someone has an idea or approach that I have not considered.

In reply to Steven Fiedler

Re: File upload

by Alex Jordan -

Here is one thing you could do with currently available tools. Other people may have a better idea.

  1. Make sure all exercises that are related to this load PGcourse.pl.
  2. In PGcourse.pl, create a hash that stores your users' data that they collected. You would have to manually enter that data. And you would know best how to organize it. But for example this hash might have something like
    alex.jordan => {this => that, this => that, etc}. Actually it wouldn't need to be entirely manually entered. If you gather it using a WeBWorK exercise, then you could go grab the answers.log file in templates/logs and process it in a way to reliably turn their answers to that exercise into a hash declaration using a script that you run periodically.
  3. Problem code can access this hash. If you named the hash studentData, then
    studentData{$envir{inputs_ref}{effectiveUser}}
    would access the values. $envir{inputs_ref}{effectiveUser} would be 'alex.jordan' when alex.jordan is the effective user. (Maybe there is a different environment variable that would also access things like 'alex.jordan' and be better in some way than $envir{inputs_ref}{effectiveUser}, but that is what comes to mind first for me.) You would need to code things that are based on accessing that hash so they do the right thing when the data for that user has not yet been entered into that hash.

In reply to Alex Jordan

Re: File upload

by Alex Jordan -
It occurred to me that I didn't really respond to what you asked. But you could code the exercises so that if their data is not yet entered into that hash, then the problems show something else, like a simple message saying they will need to wait.

Also for the exercise where students enter their data, there could be a manually graded essay question. You would only award 100% for the exercise once you have processed their data into that hash. And then you could use conditional release to only grant access to the later exercise sets based on having 100% on the data upload assignment.
In reply to Alex Jordan

Re: File upload

by Steven Fiedler -

Many thanks Alex. I hadn't considered the use of a simple essay problem to solve the issue of students entering their ID codes for their unknown samples. The lock release that you described will be helpful for giving our instructors some granular control for handling the more substantial data sets.

In reply to Alex Jordan

Re: File upload

by Steven Fiedler -
A subsequent thought... Students would be less likely to change data if they were unable to view their score for say an unknown ID determination problem until after the deadline. However, my impression is that such a setting is made by the assignment type, i.e., at the Sets Manager level.

To permit a certain problem in a set to suppress scoring information, I would appreciate any guidance for an approach such as changing the value of the check_answers_after_open_date_without_attempts in the %permissionLevels hash on the fly in course.conf (link).  While I suspect that such a value could be read into a problem, I would be surprised if it could could be altered within a problem.
In reply to Steven Fiedler

Re: File upload

by Steven Fiedler -
A heads up if anyone else travels down a similar path in searching for a work-around to this issue. I was wondering why the showPartialCorrectAnswers flag didn't appear effective in this sample essay problem. This would have, in principle, blocked display of the student score in a problem that contains an essay component.

In reading the source for pg/macros/PG.pl, there is a comment at line 1324 in version 2.19, that contains the following reminder:
                        # Generate the result summary if results are being shown.
                        # FIXME: This is set up to occur when it did previously.  That is it ignores the value of
                        # $PG->{flags}{showPartialCorrectAnswers}. It seems that is incorrect, as it makes that setting rather
                        # pointless.  The summary still reveals if the answer is correct or not.

As such, a student can determine their performance on the first part immediately.
In reply to Steven Fiedler

Re: File upload

by Glenn Rice -
I added that comment. I also deleted that comment in an upcoming pull request. It turns out the comment was not correct. This also has nothing to do with what you are observing. Essay answers are not part of that at all. Settting $showPartialCorrectAnswers for a problem that only has one answer is pointless. Note that I don't count essay answers in that because they never are included in the count of correct and incorrect answers.

The real point of the $showPartialCorrectAnswers variable is for problems with multiple answers like a matching problem or several true/false answers and you want to prevent students from guessing.  They are still told how many are correct, but not which ones are correct.

Also note that $showPartialCorrectAnswers is not honored when viewing a problem as an instructor.  It is only honored for students.
In reply to Steven Fiedler

Re: File upload

by Steven Fiedler -

I made some headway into effectively converting the sample essay problem to the behavior I originally expected, i.e., a summative assessment. The correct/incorrect indicator on the true/false toggle problem can be suppressed by triggering an action around the showAttemptResults flag.  Below is some code to that effect.

However, students can still indirectly determine if they were successful by viewing the problem score both under the status column on the set page and the Grade page. If anyone has an idea of how to hide these values until after the due date on a homework assignment, this would be helpful. For our use case, there are advantages to mixing formative and summative assessment and it would be inconvenient for the students to take a webwork test to complete just one additional question.


DOCUMENT();
loadMacros(
    'PGstandard.pl',  'PGML.pl',
    'parserPopUp.pl', 'PGessaymacros.pl',
    'PGcourse.pl'
);

$time=time();
$close=$rh_envir->{dueDate};
if($time < $close){  $rh_envir->{showAttemptResults}=0;}

$popup = PopUp(
    [ 'Choose', 'True', 'False' ],    # choices
    'False'                           # corect answer
);

$a = random(2, 5);

$f1 = Compute("ln(x (x-$a))");
$f2 = Compute("ln(x) + ln(x-$a)");

BEGIN_PGML
Answer the following true / false question and then explain your answer.  Your
answers will be read and graded manually at a later time.

[_]{$popup} For all real numbers [`x`], [`[$f1] = [$f2]`].

Please explain your reasoning in the answer box below.
[@ ANS( essay_cmp() ); essay_box(8, 60) @]*
END_PGML

ENDDOCUMENT();


In reply to Steven Fiedler

Re: File upload

by Steven Fiedler -

I largely answered my own question.  The below code gets me to where I wanted to go. I suspect that anything more sophisticated would need write access to the sets hash in the library *.pm files.

DOCUMENT();
loadMacros('PGstandard.pl','PGML.pl','PGcourse.pl','PGessaymacros.pl');

$num=1;
BEGIN_PGML
Enter the number [$num]: [___]
END_PGML

ANS(Real($num)->cmp(checker=>sub {
    my ($correct,$student,$ansHash) = @_;
    my $time=time();
    my $close=$rh_envir->{dueDate};
    if($time < $close){  
      $rh_envir->{showAttemptResults}=0;
      $ansHash->{ans_message}="This answer will be graded at a later time.";
      return 0;
    }
    elsif($student==$correct){ return 1; } #time > close && correct
    else{ return 0; }  #time > close && incorrect

    }#end sub
   ) #end cmp
); #end ANS()

BEGIN_PGML
Please explain your reasoning in the answer box below.
[@ ANS( essay_cmp() ); essay_box(8, 60) @]*
END_PGML

ENDDOCUMENT();