O365-HomeAssistant icon indicating copy to clipboard operation
O365-HomeAssistant copied to clipboard

All day event timezone fix

Open mshish opened this issue 4 years ago • 3 comments

Attempts to fix PTST/O365-HomeAssistant#85 Two changes:

  1. Bring in fix from home-assistant/core#48642 which doesn't make much of a difference here (branch doesn't appear to get hit with all day events).
  2. Fix the timezone shift for all day events. I'm not sure this is in the right place since it appears o365 is returning the event as if it were on GMT (but it's not). This may only work if the all day event was actually in the local timezone.

mshish avatar May 22 '21 12:05 mshish

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.94%.

Quality metrics Before After Change
Complexity 2.28 ⭐ 2.49 ⭐ 0.21 👎
Method Length 53.00 ⭐ 55.13 ⭐ 2.13 👎
Working memory 9.40 🙂 9.53 🙂 0.13 👎
Quality 71.62% 🙂 70.68% 🙂 -0.94% 👎
Other metrics Before After Change
Lines 304 312 8
Changed files Quality Before Quality After Quality Change
custom_components/o365/calendar.py 71.62% 🙂 70.68% 🙂 -0.94% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
custom_components/o365/calendar.py setup_platform 8 ⭐ 160 😞 12 😞 50.41% 🙂 Try splitting into smaller methods. Extract out complex expressions
custom_components/o365/calendar.py CalendarServices.respond_calendar_event 5 ⭐ 136 😞 11 😞 57.61% 🙂 Try splitting into smaller methods. Extract out complex expressions
custom_components/o365/calendar.py O365CalendarData.async_update 1 ⭐ 110 🙂 15 😞 58.79% 🙂 Extract out complex expressions
custom_components/o365/calendar.py O365CalendarData.async_get_events 4 ⭐ 114 🙂 10 😞 63.16% 🙂 Extract out complex expressions
custom_components/o365/calendar.py O365CalendarEventDevice.async_update 1 ⭐ 98 🙂 12 😞 64.65% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

sourcery-ai[bot] avatar May 22 '21 12:05 sourcery-ai[bot]

If O365 uses RFC 5545, then it can be assumed that all-day events are always in the local time zone.

franc6 avatar Jun 06 '21 20:06 franc6

Do I need to address the Sourcery issues to get this accepted?

mshish avatar Jul 10 '21 14:07 mshish