#166 Fix showing the meeting in their proper time around DST
Merged 5 years ago by pingou. Opened 7 years ago by pingou.

file modified
+6 -5
@@ -1077,9 +1077,6 @@ 

              'errors')

          return flask.redirect(flask.url_for('index'))

  

-     meeting_utc = fedocallib.convert_meeting_timezone(

-         org_meeting, org_meeting.meeting_timezone, 'UTC')

- 

      editor = False

      if is_meeting_manager(org_meeting) or is_calendar_admin(

              org_meeting.calendar):
@@ -1093,9 +1090,13 @@ 

              pass

  

      next_meeting = fedocallib.update_date_rec_meeting(

-         meeting_utc, action='next', date_limit=date_limit)

+         org_meeting, action='next', date_limit=date_limit)

+ 

+     meeting_utc = fedocallib.convert_meeting_timezone(

+         next_meeting, org_meeting.meeting_timezone, 'UTC')

+ 

      next_meeting = fedocallib.convert_meeting_timezone(

-         next_meeting, 'UTC', tzone)

+         next_meeting, org_meeting.meeting_timezone, tzone)

  

      return flask.render_template(

          'view_meeting.html',

file modified
+1 -1
@@ -148,7 +148,7 @@ 

      meeting_timezone = wtforms.SelectField(

          _('Time zone'),

          [wtforms.validators.Required()],

-         choices=[(tzone, tzone) for tzone in common_timezones])

+         choices=[(tzone, tzone) for tzone in sorted(common_timezones)])

  

      wiki_link = wtforms.TextField(_('More information URL'))

  

@@ -36,7 +36,8 @@ 

                {{ _('End:') }}

            </span>

            {{ next_meeting.meeting_date_end.strftime('%a, %B %d, %Y') }} - {{

-               next_meeting.meeting_time_stop }} {{ tzone }} </li>

+               next_meeting.meeting_time_stop.strftime('%H:%M') }} {{ tzone }}

+         </li>

      </ul>

  

      <div id="countdown"></div>

file modified
+113 -1
@@ -2,7 +2,7 @@ 

  #-*- coding: utf-8 -*-

  

  """

-  (c) 2012 - Copyright Pierre-Yves Chibon

+  (c) 2012-2017 - Copyright Pierre-Yves Chibon

   Author: Pierre-Yves Chibon <pingou@pingoured.fr>

  

   Distributed under License GPLv3 or later
@@ -597,6 +597,118 @@ 

              flask.g.fas_user = FakeUser(['gitr2spec'])

              self.assertFalse(fedocal.is_calendar_admin(calendar))

  

+     def test_view_meeting_page_dst(self):

+         """ Test the view_meeting_page function accross the DST time change

+         """

+         # Create calendar

+         obj = model.Calendar(

+             calendar_name='test_calendar',

+             calendar_contact='test@example.com',

+             calendar_description='This is a test calendar',

+             calendar_editor_group='fi-apprentice',

+             calendar_admin_group='infrastructure-main2')

+         obj.save(self.session)

+         self.session.commit()

+         self.assertNotEqual(obj, None)

+ 

+         # Add a meeting

+         mdate = date(2017, 1, 2)

+         obj = model.Meeting(  # id:1

+             meeting_name='Fedora-fr-test-meeting',

+             meeting_date=mdate,

+             meeting_date_end=mdate,

+             meeting_time_start=time(9, 00),

+             meeting_time_stop=time(10, 00),

+             meeting_timezone='America/New_York',

+             meeting_information='This is a test meeting',

+             calendar_name='test_calendar',

+             recursion_frequency=7,

+             recursion_ends=mdate + timedelta(days=365)

+         )

+         obj.add_manager(self.session, 'pingou, shaiton,')

+         obj.save(self.session)

+         self.session.commit()

+         self.assertNotEqual(obj, None)

+ 

+         # Winter time

+         output = self.app.get('/meeting/1/?from_date=2017-02-27')

+         self.assertEqual(output.status_code, 200)

+         self.assertTrue(

+             '<title>Meeting "Fedora-fr-test-meeting" - Fedocal</title>'

+             in output.data)

+         self.assertTrue(

+             'Mon, February 27, 2017 - 14:00 UTC'

+             in output.data)

+         self.assertTrue(

+             'Mon, February 27, 2017 - 15:00:00 UTC'

+             in output.data)

+ 

+         # Summer time

+         output = self.app.get('/meeting/1/?from_date=2017-03-13')

+         self.assertEqual(output.status_code, 200)

+         self.assertTrue(

+             '<title>Meeting "Fedora-fr-test-meeting" - Fedocal</title>'

+             in output.data)

+         self.assertTrue(

+             'Mon, March 13, 2017 - 13:00 UTC'

+             in output.data)

+         self.assertTrue(

+             'Mon, March 13, 2017 - 14:00 UTC'

+             in output.data)

+ 

+         # Summer time in the US

+         output = self.app.get(

+             '/meeting/1/?from_date=2017-03-13&tzone=America/New_York')

+         self.assertEqual(output.status_code, 200)

+         self.assertTrue(

+             '<title>Meeting "Fedora-fr-test-meeting" - Fedocal</title>'

+             in output.data)

+         self.assertTrue(

+             'Mon, March 13, 2017 - 13:00:00 UTC'

+             in output.data)

+         self.assertTrue(

+             'Mon, March 13, 2017 - 14:00:00 UTC'

+             in output.data)

+         self.assertTrue(

+             'Mon, March 13, 2017 - 09:00 America/New_York'

+             in output.data)

+         self.assertTrue(

+             'Mon, March 13, 2017 - 10:00 America/New_York'

+             in output.data)

+ 

+         # Summer time in the US but not in Europe

+         output = self.app.get(

+             '/meeting/1/?from_date=2017-03-13&tzone=Europe/Paris')

+         self.assertEqual(output.status_code, 200)

+         self.assertTrue(

+             '<title>Meeting "Fedora-fr-test-meeting" - Fedocal</title>'

+             in output.data)

+         self.assertTrue(

+             'Mon, March 13, 2017 - 13:00:00 UTC'

+             in output.data)

+         self.assertTrue(

+             'Mon, March 13, 2017 - 14:00:00 UTC'

+             in output.data)

+         self.assertTrue(

+             'Mon, March 13, 2017 - 14:00 Europe/Paris'

+             in output.data)

+         self.assertTrue(

+             'Mon, March 13, 2017 - 15:00 Europe/Paris'

+             in output.data)

+ 

+         # Winter time again

+         output = self.app.get('/meeting/1/?from_date=2017-11-20')

+         self.assertEqual(output.status_code, 200)

+         self.assertTrue(

+             '<title>Meeting "Fedora-fr-test-meeting" - Fedocal</title>'

+             in output.data)

+         self.assertTrue(

+             'Mon, November 20, 2017 - 14:00 UTC'

+             in output.data)

+         self.assertTrue(

+             'Mon, November 20, 2017 - 15:00 UTC'

+             in output.data)

+ 

      def test_is_calendar_manager(self):

          """ Test the is_calendar_manager function. """

          self.__setup_db()

Looks like it needs someone to review it :)

I'd say go ahead and merge it since no one reviewed it or was assigned to.

You could do the review :)

It looks fine. As long as you have run the new test and it passed, I
think it's good to push to the real world ;)

Regards,
Alick

On Wed, Apr 11, 2018 at 3:46 PM, Pierre-YvesChibon pagure@pagure.io wrote:

pingou commented on the pull-request: Fix showing the meeting in their proper time around DST that you are following:
You could do the review :)

To reply, visit the link below or just reply to this email
https://pagure.io/fedocal/pull-request/166

rebased onto bec14d3

5 years ago

Thanks for the review :)

Pull-Request has been merged by pingou

5 years ago