← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~nik90/ubuntu-clock-app/fixes-1442518 into lp:ubuntu-clock-app

 

Nekhelesh Ramananthan has proposed merging lp:~nik90/ubuntu-clock-app/fixes-1442518 into lp:ubuntu-clock-app.

Commit message:
Fixes alarms after midnight being incorrectly enabled for the next day.

Requested reviews:
  Ubuntu Clock Developers (ubuntu-clock-dev)
Related bugs:
  Bug #1442518 in Ubuntu Clock App: "Enabling alarm after midnight schedules it for the next day"
  https://bugs.launchpad.net/ubuntu-clock-app/+bug/1442518

For more details, see:
https://code.launchpad.net/~nik90/ubuntu-clock-app/fixes-1442518/+merge/261905

This MP should fix alarms after midnight being incorrectly enabled for the next day. This fix was only possible with the help from launchpad user themeles. Thnx!

Steps to test
1. Open clock app and create an alarm for 10:00 AM and disable it.
2. Close clock app
3. Set time manually to sometime after midnight like 01:10 AM using the system settings app and date to tomorrow or the date after.
4. Open clock app
5. Try enabling the alarms which were disabled in the first step.

The alarms should be schedule for that day 10:00 AM instead of the next day since it is past midnight.
-- 
Your team Ubuntu Clock Developers is requested to review the proposed merge of lp:~nik90/ubuntu-clock-app/fixes-1442518 into lp:ubuntu-clock-app.
=== modified file 'app/alarm/AlarmDelegate.qml'
--- app/alarm/AlarmDelegate.qml	2015-01-22 00:11:57 +0000
+++ app/alarm/AlarmDelegate.qml	2015-06-14 09:59:27 +0000
@@ -104,7 +104,13 @@
                     var currentTime = new Date()
                     alarmData.daysOfWeek = alarmUtils.get_alarm_day(currentTime.getDay())
 
-                    if (alarmData.date.getTime() <= currentTime.getTime()) {
+                    var _alarmTimeInSeconds = alarmData.date.getHours() * 3600 + alarmData.date.getMinutes() * 60 + alarmData.date.getSeconds()
+                    var _currentTimeInSeconds = currentTime.getHours() * 3600 + currentTime.getMinutes() *60 + currentTime.getSeconds()
+
+                    /*
+                     Check the alarm time to determine if the alarm is to be scheduled for today or tomorrow.
+                    */
+                    if (_alarmTimeInSeconds < _currentTimeInSeconds) {
                         var tomorrow = currentTime
                         tomorrow.setDate(tomorrow.getDate() + 1)
                         alarmData.daysOfWeek = alarmUtils.get_alarm_day(tomorrow.getDay())

=== modified file 'debian/changelog'
--- debian/changelog	2015-05-26 14:40:39 +0000
+++ debian/changelog	2015-06-14 09:59:27 +0000
@@ -22,6 +22,7 @@
     location access (LP: #1393827)
   * Increased date font size (LP: #1432736)
   * Fixed empty state component width warnings
+  * Fixed alarm after midnight being incorrectly enabled for the next day (LP: #1442518)
   
   [Penk Chen]
   * Fixed DigitalMode time being empty in chineese locale (LP: #1458808)

=== modified file 'po/com.ubuntu.clock.pot'
--- po/com.ubuntu.clock.pot	2015-05-26 14:38:54 +0000
+++ po/com.ubuntu.clock.pot	2015-06-14 09:59:27 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-05-26 14:38+0000\n"
+"POT-Creation-Date: 2015-06-14 09:49+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@xxxxxx>\n"


Follow ups