← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~themeles/ubuntu-clock-app/bugfix-1442518 into lp:ubuntu-clock-app

 

themeles has proposed merging lp:~themeles/ubuntu-clock-app/bugfix-1442518 into lp:ubuntu-clock-app.

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/~themeles/ubuntu-clock-app/bugfix-1442518/+merge/261910

This MP should fix alarms after midnight being incorrectly enabled for the next day. This fix was possible due to the help of nik90. 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:~themeles/ubuntu-clock-app/bugfix-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 14:29:37 +0000
@@ -100,14 +100,14 @@
                  gone-off and the user is re-enabling the alarm. Repeating
                  alarms do this automatically.
                 */
-                if(checked && type === Alarm.OneTime && alarmData.date < new Date()) {
+                if(checked && type === Alarm.OneTime) {
                     var currentTime = new Date()
-                    alarmData.daysOfWeek = alarmUtils.get_alarm_day(currentTime.getDay())
-
-                    if (alarmData.date.getTime() <= currentTime.getTime()) {
-                        var tomorrow = currentTime
-                        tomorrow.setDate(tomorrow.getDate() + 1)
-                        alarmData.daysOfWeek = alarmUtils.get_alarm_day(tomorrow.getDay())
+                    alarmData.daysOfWeek = Alarm.AutoDetect
+                    var now=new Date()
+                    if (alarmData.date.getHours()*60+alarmData.date.getMinutes() <= currentTime.getHours()*60+currentTime.getMinutes()) {
+                        alarmData.date = new Date(now.getFullYear(),now.getMonth(),now.getDate()+1,alarmData.date.getHours(),alarmData.date.getMinutes(),0,0)
+                    } else {
+                        alarmData.date = new Date(now.getFullYear(),now.getMonth(),now.getDate(),alarmData.date.getHours(),alarmData.date.getMinutes(),0,0)
                     }
                 }
 

=== 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 14:29:37 +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 16:23+0200\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