WeBWorK Main Forum

DateTime error

DateTime error

by Hal Sadofsky -
Number of replies: 5

We're trying to set up a new WeBWorK server. I've been moving courses over (archive, scp, then unarchive) and checking that problem sets (etc.) work, and I've run into a strange problem.

One of the courses I moved over, when I try to edit problems for an existing homework (that was moved over) under Hmwk Sets Editor gives the following errors:

Error messages

The 'epoch' parameter ("") to DateTime::from_epoch did not pass regex check
at /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi/DateTime.pm line 452
DateTime::from_epoch(undef, 'epoch', '', 'time_zone', 'America/Los_Angeles') called at /opt/webwork/webwork2/lib/WeBWorK/Utils.pm line 594
WeBWorK::Utils::formatDateTime('', 'America/Los_Angeles') called at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm line 2014
WeBWorK::ContentGenerator::formatDateTime('WeBWorK::ContentGenerator::Instructor::ProblemSetDetail=HASH(...', '') called at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm line 478
WeBWorK::ContentGenerator::Instructor::ProblemSetDetail::FieldHTML('WeBWorK::ContentGenerator::Instructor::ProblemSetDetail=HASH(...', 'sadofsky', '2_3_Integer_Exponents', undef, 'WeBWorK::DB::Record::Set=HASH(0x5cf6738)', undef, 'open_date') called at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm line 381
WeBWorK::ContentGenerator::Instructor::ProblemSetDetail::FieldTable('WeBWorK::ContentGenerator::Instructor::ProblemSetDetail=HASH(...', 'sadofsky', '2_3_Integer_Exponents', undef, 'WeBWorK::DB::Record::Set=HASH(0x5cf6738)', undef) called at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm line 1832
WeBWorK::ContentGenerator::Instructor::ProblemSetDetail::body('WeBWorK::ContentGenerator::Instructor::ProblemSetDetail=HASH(...', 'HASH(0x5c75080)') called at /opt/webwork/webwork2/lib/WeBWorK/Template.pm line 152
WeBWorK::Template::template('/opt/webwork/webwork2/conf/templates/math/system.template', 'WeBWorK::ContentGenerator::Instructor::ProblemSetDetail=HASH(...') called at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm line 491
WeBWorK::ContentGenerator::content('WeBWorK::ContentGenerator::Instructor::ProblemSetDetail=HASH(...') called at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm line 195
WeBWorK::ContentGenerator::go('WeBWorK::ContentGenerator::Instructor::ProblemSetDetail=HASH(...') called at /opt/webwork/webwork2/lib/WeBWorK.pm line 353
WeBWorK::dispatch('Apache2::RequestRec=SCALAR(0x599c8f8)') called at /opt/webwork/webwork2/lib/Apache/WeBWorK.pm line 115
eval {...} called at /opt/webwork/webwork2/lib/Apache/WeBWorK.pm line 115
Apache::WeBWorK::handler('Apache2::RequestRec=SCALAR(0x599c8f8)') called at -e line 0
eval {...} called at -e line 0

Call stack

The information below can help locate the source of the problem.

  • in Carp::confess called at line 452 of /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi/DateTime.pm
  • in DateTime::from_epoch called at line 594 of /opt/webwork/webwork2/lib/WeBWorK/Utils.pm
  • in WeBWorK::Utils::formatDateTime called at line 2014 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm
  • in WeBWorK::ContentGenerator::formatDateTime called at line 478 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm
  • in WeBWorK::ContentGenerator::Instructor::ProblemSetDetail::FieldHTML called at line 381 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm
  • in WeBWorK::ContentGenerator::Instructor::ProblemSetDetail::FieldTable called at line 1832 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm
  • in WeBWorK::ContentGenerator::Instructor::ProblemSetDetail::body called at line 152 of /opt/webwork/webwork2/lib/WeBWorK/Template.pm
  • in WeBWorK::Template::template called at line 491 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm
  • in WeBWorK::ContentGenerator::content called at line 195 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm
  • in WeBWorK::ContentGenerator::go called at line 353 of /opt/webwork/webwork2/lib/WeBWorK.pm



Does anyone have any insight?

thanks, Hal

In reply to Hal Sadofsky

Re: DateTime error

by Michael Gage -
Hal,

Check the open, due and answer dates defined for this homework set. I expect you'll find one of them missing. If they all appear to be set to some time, then edit each of them and save the homework set and see if that fixes the problem.

The error is reporting that the "unix" time, the number of seconds since 1970 or so, is missing. This obviously shouldn't happen, but there is probably no easy way to figure out where it went missing unless you can get this misbehavior to repeat reliably.

DateTime::from_epoch(undef, 'epoch', '', 'time_zone', 'America/Los_Angeles') called at /opt/webwork/webwork2/lib/WeBWorK/Utils.pm line 594

the entry after 'epoch' is supposed to contain a number.

Let us know what happens.

-- Mike



In reply to Michael Gage

Re: DateTime error

by Fred Sullivan -
I've seen this problem also, even when the times are all ok. I think it's a bug in WeBWorK which I discovered a couple of weeks ago and forgot to report.

If the homework set is assigned to NO users, then you get this error. If you assign to at least one user, it goes away.

In reply to Fred Sullivan

Re: DateTime error

by Hal Sadofsky -

OK - that is bizarre.

In my case assigning it to one user did not make it go away. But assigning it to myself (I'm not the actual instructor) _did_ make it go away.

Thanks for the work-around!

Hal

In reply to Michael Gage

Re: DateTime error

by Hal Sadofsky -

Thanks Mike.

This is the kind of think I suspected, but I can't figure out the problem. When I'm looking at the view in the Homework Sets Editor, I can see what look like well-formed Open, Due and Answer dates.

The error doesn't come until I click on the number under Edit Problems.

And I can look at the .def file from which the homework set is imported, and there don't seem to be any glaring date problems there. For example I'm attaching is a .def file from which I can (successfully) import a problem set, but then I get this error when I click on "Edit Problems."

The dates look good to me (and they worked on the system that I moved this course _from_), so I wonder if I have the wrong version of some perl module and it is doing something unexpected with the date at some point.

Hal



In reply to Hal Sadofsky

Re: DateTime error

by Michael Gage -
The general conclusion I draw from this:

Editing a problem in a homework set which you have not assigned to yourself can lead to some bizarre behavior.

When the library browser creates a homework set it automatically assigns (actually it asks first) that set to the creator. If you mainly create sets through the library browser as many do you don't run in to this behavior.

This knowledge gives one a work around for this user interface bug. It's not clear what the fix should be -- it might become a bit complicated. One possibility is that you aren't allowed to edit a set which you haven't been assigned to. Attempting to edit the set automatically assigns you to the set.

This doesn't seem like the best approach in terms of "principle", but it might work in practice and would be easiest to code.

Handling questions which have not been assigned to sets and sets which have not been assigned to a user is currently done on an ad hoc basis in each portion of the code so inconsistencies arise.

-- Mike