handle wimba conference date parsing in ruby18/ruby19.

fixes CNVS-3556

wimba passes dates as MM/DD/YYYY, but ruby 1.9 expects date
strings given to `parse` to be in DD/MM/YYYY format. this
commit specifies a date format to avoid this issue and
remain compatible with both 1.8 and 1.9 servers.

test plan:
  * create a wimba conference;
  * visit its archive;
  * verify that canvas redirects to wimba and does not
    throw a 500 error.

Change-Id: Ic822a01f950b2465a5328a0b80b8b11c3e63c99d
Reviewed-on: https://gerrit.instructure.com/17507
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
This commit is contained in:
Zach Pendleton 2013-02-06 15:34:07 -07:00
parent 8ddee6d7ff
commit b78ab1c5bc
1 changed files with 7 additions and 2 deletions

View File

@ -36,8 +36,13 @@ class WimbaConference < WebConference
end
if date_info = data[:longname].match(Regexp.new(" - (\\d{2}/\\d{2}/\\d{4} \\d{2}:\\d{2})\\z"))
# convert from wimba's local time to the user's local time
tz = ActiveSupport::TimeZone[config[:timezone] || config[:plugin].default_settings[:timezone]]
new_date = datetime_string(tz.parse(date_info[1]))
tz = ActiveSupport::TimeZone[config[:timezone] || config[:plugin].default_settings[:timezone]]
new_date = nil
Time.use_zone(tz) do
new_date = datetime_string(DateTime.strptime(date_info[1], '%m/%d/%Y %H:%M'))
end
data[:longname].sub!(date_info[1], new_date)
end
urls << {:id => data[:class_id], :name => data[:longname]} unless url_id && data[:class_id] != url_id