{"action":"created","issue":{"url":"https://api.github.com/repos/openwebwork/webwork2/issues/900","repository_url":"https://api.github.com/repos/openwebwork/webwork2","labels_url":"https://api.github.com/repos/openwebwork/webwork2/issues/900/labels{/name}","comments_url":"https://api.github.com/repos/openwebwork/webwork2/issues/900/comments","events_url":"https://api.github.com/repos/openwebwork/webwork2/issues/900/events","html_url":"https://github.com/openwebwork/webwork2/pull/900","id":382389401,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMyMTA5MDEz","number":900,"title":"Timezone issue fix for creating assignment","user":{"login":"taniwallach","id":39089094,"node_id":"MDQ6VXNlcjM5MDg5MDk0","avatar_url":"https://avatars2.githubusercontent.com/u/39089094?v=4","gravatar_id":"","url":"https://api.github.com/users/taniwallach","html_url":"https://github.com/taniwallach","followers_url":"https://api.github.com/users/taniwallach/followers","following_url":"https://api.github.com/users/taniwallach/following{/other_user}","gists_url":"https://api.github.com/users/taniwallach/gists{/gist_id}","starred_url":"https://api.github.com/users/taniwallach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taniwallach/subscriptions","organizations_url":"https://api.github.com/users/taniwallach/orgs","repos_url":"https://api.github.com/users/taniwallach/repos","events_url":"https://api.github.com/users/taniwallach/events{/privacy}","received_events_url":"https://api.github.com/users/taniwallach/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-11-19T20:56:16Z","updated_at":"2018-11-19T21:20:38Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/openwebwork/webwork2/pulls/900","html_url":"https://github.com/openwebwork/webwork2/pull/900","diff_url":"https://github.com/openwebwork/webwork2/pull/900.diff","patch_url":"https://github.com/openwebwork/webwork2/pull/900.patch"},"body":"## Explanation of changes\r\n\r\n1. Add a \"safe\" time format `\"%m/%d/%Y at %I:%M%P\"`  to the `my $fDueDate = $self->formatDateTime(...)` call to avoid issues with the short time-zone alias used by `%Z` in the default time format which causes the following `$dueDate = $self->parseDateTime()` call to fail in many time-zones. \r\n   * Ex: Asia/Jerusalem Africa/Johannesburg America/Santiago Asia/Bangkok Australia/Perth\r\n\r\n2. In all 4 files use the same error message: \r\n   * `The set name '[_1]' is already in use.  Pick a different name if you would like to start a new set.`\r\n  *using* `$r->maketext` when the requested set name is already in use.\r\n   * `lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm` \r\n     * had this maketext string which was copied to the other files.\r\n   * `lib/WeBWorK/ContentGenerator/Instructor/SetMakernojs.pm` and\r\n   * `lib/WeBWorK/ContentGenerator/Instructor/GetLibrarySetProblems.pm` \r\n     * had no maketext but had essentially the same text.  \r\n     * added $r->maketext()\r\n   * `lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm`\r\n     * had slightly different text in maketext.\r\n     * changed to the \"standardized\" message.\r\n\r\n## Explanation of why the changes are needed\r\n * **Before the change**, setting the course timezone to `Asia/Jerusalem` or many other timezones **would trigger an error whenever the user tried to create a new homework set** using:\r\n    * the \"Create a New Set in This Course\" button in the library browser (Calls `SetMaker.pm`)\r\n    * the \"Create\" new set button from \"Instructor Tools\".  (This method also calls `SetMaker.pm`)\r\n    * the \"Create\" part of \"Hmwk Sets Editor\" (This method calls `lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm`)\r\n * **After this patch, the error no longer occurs.**\r\n * The cause of the error is the fact that the default time format (`\"%m/%d/%Y at %I:%M%P %Z\"`)\r\n used by `lib/WeBWorK/Utils.pm` includes `%Z` which generates a \"short\" time-zone string, which may not be able to be read back in during the parsing stage as representing a unique time-zone.\r\n * The error messages like\r\n\r\n```\r\nWeBWorK error\r\nAn error occured while processing your request. For help, please send mail\r\nto this site's webmaster (techdesk@mathnet.technion.ac.il), including all of\r\nthe following information as well as what what you were doing when the error\r\noccured.\r\n\r\nDATE\r\n\r\nWarning messages\r\n\r\nError messages\r\n        Time zone 'IST' not recognized.\r\n\r\nCall stack\r\n\r\nThe information below can help locate the source of the problem.\r\n\r\nin WeBWorK::Utils::parseDateTime called at line 2255 of         /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm\r\nin WeBWorK::ContentGenerator::parseDateTime called at line 1490 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm\r\nin WeBWorK::ContentGenerator::Instructor::SetMaker::pre_header_initialize called at line 214 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm\r\nin WeBWorK::ContentGenerator::go called at line 384 of /opt/webwork/webwork2/lib/WeBWorK.pm\r\n```\r\n\r\n```\r\nWeBWorK error\r\nAn error occured while processing your request. For help, please send mail\r\nto this site's webmaster (techdesk@mathnet.technion.ac.il), including all of\r\nthe following information as well as what what you were doing when the error\r\noccured.\r\n\r\nDATE\r\n\r\nWarning messages\r\n\r\nError messages\r\n    Time zone 'IST' not recognized.\r\n\r\nCall stack\r\n\r\nThe information below can help locate the source of the problem.\r\n\r\nin WeBWorK::Utils::parseDateTime called at line 2255 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm\r\nin WeBWorK::ContentGenerator::parseDateTime called at line 1150 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm\r\nin WeBWorK::ContentGenerator::Instructor::ProblemSetList2::create_handler\r\ncalled at line 404 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm\r\nin WeBWorK::ContentGenerator::Instructor::ProblemSetList2::initialize called at line 231 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm\r\nin WeBWorK::ContentGenerator::go called at line 384 of /opt/webwork/webwork2/lib/WeBWorK.pm\r\n```\r\n## Additional information\r\n * It does not seem necessary to include **any** timezone in this process, as the parse phase will be done for the course time-zone regardless of what had been included in the originally generated due date string.\r\n * The Perl documentation at https://metacpan.org/pod/DateTime about `$dt->time_zone_short_name()` states:\r\n   * This method returns the time zone abbreviation for the current time zone, such as \"PST\" or \"GMT\". These names are not definitive, and should **not** be used in any application intended for general use by users around the world.\r\n * http://webwork.maa.org/wiki/Dates,_Times,_and_Time_Zones#Detailed_Information  suggests not listing an abbreviated time zone when entering dates, but in this setting WW was adding it automatically.\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/openwebwork/webwork2/issues/comments/440045484","html_url":"https://github.com/openwebwork/webwork2/pull/900#issuecomment-440045484","issue_url":"https://api.github.com/repos/openwebwork/webwork2/issues/900","id":440045484,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MDA0NTQ4NA==","user":{"login":"taniwallach","id":39089094,"node_id":"MDQ6VXNlcjM5MDg5MDk0","avatar_url":"https://avatars2.githubusercontent.com/u/39089094?v=4","gravatar_id":"","url":"https://api.github.com/users/taniwallach","html_url":"https://github.com/taniwallach","followers_url":"https://api.github.com/users/taniwallach/followers","following_url":"https://api.github.com/users/taniwallach/following{/other_user}","gists_url":"https://api.github.com/users/taniwallach/gists{/gist_id}","starred_url":"https://api.github.com/users/taniwallach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taniwallach/subscriptions","organizations_url":"https://api.github.com/users/taniwallach/orgs","repos_url":"https://api.github.com/users/taniwallach/repos","events_url":"https://api.github.com/users/taniwallach/events{/privacy}","received_events_url":"https://api.github.com/users/taniwallach/received_events","type":"User","site_admin":false},"created_at":"2018-11-19T21:20:38Z","updated_at":"2018-11-19T21:20:38Z","author_association":"NONE","body":"## Testing\r\n * I tested the modification to the new code which uses the time formatting string in\r\n   * `lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm`\r\n   * `lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm`\r\n * I did not test (but the code is essentially identical to that in `SetMaker.pm`):\r\n   * `lib/WeBWorK/ContentGenerator/Instructor/SetMakernojs.pm`\r\n   * Testing probably requires making a configuration change to use this no-JavaScript version of the Set Maker code.\r\n * I did not test (but the code is essentially identical to that in `SetMaker.pm`):\r\n   * `lib/WeBWorK/ContentGenerator/Instructor/GetLibrarySetProblems.pm`\r\n   * I'm not sure when this code gets called, but the bug appears in the old code and the change will do the fix. "}}
{"actor":{"display_login":"taniwallach"}}