Merge lp:~gang65/ubuntu-clock-app/ubuntu-clock-app-alarm-description-fix into lp:ubuntu-clock-app

Proposed by Bartosz Kosiorek
Status: Merged
Approved by: Bartosz Kosiorek
Approved revision: 404
Merged at revision: 420
Proposed branch: lp:~gang65/ubuntu-clock-app/ubuntu-clock-app-alarm-description-fix
Merge into: lp:ubuntu-clock-app
Diff against target: 198 lines (+55/-23)
7 files modified
app/alarm/AlarmDelegate.qml (+2/-2)
app/alarm/AlarmUtils.qml (+17/-3)
app/worldclock/WorldCityList.qml (+1/-1)
debian/changelog (+8/-1)
manifest.json.in (+1/-1)
tests/unit/tst_alarm.qml (+6/-3)
tests/unit/tst_alarmUtils.qml (+20/-12)
To merge this branch: bzr merge lp:~gang65/ubuntu-clock-app/ubuntu-clock-app-alarm-description-fix
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Ubuntu Clock Developers Pending
Review via email: mp+275932@code.launchpad.net

Commit message

Fix alarm difference time description, during DST change (LP: #1510694)

Description of the change

Fix alarm difference time description, during DST change (LP: #1510694)

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

FAILED: Continuous integration, rev:403
http://91.189.93.70:8080/job/ubuntu-clock-app-ci/858/
Executed test runs:

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/ubuntu-clock-app-ci/858/rebuild

review: Needs Fixing (continuous-integration)
404. By Bartosz Kosiorek

Bump version number to 3.7

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/alarm/AlarmDelegate.qml'
--- app/alarm/AlarmDelegate.qml 2015-10-16 07:38:33 +0000
+++ app/alarm/AlarmDelegate.qml 2015-10-29 22:15:16 +0000
@@ -88,7 +88,7 @@
88 visible: !(type === Alarm.OneTime && !model.enabled)88 visible: !(type === Alarm.OneTime && !model.enabled)
89 elide: Text.ElideRight89 elide: Text.ElideRight
90 text: type === Alarm.Repeating ? alarmUtils.format_day_string(daysOfWeek, type)90 text: type === Alarm.Repeating ? alarmUtils.format_day_string(daysOfWeek, type)
91 : model.enabled ? alarmUtils.get_time_to_next_alarm(model.date - localTime)91 : model.enabled ? alarmUtils.get_time_to_alarm(model.date, localTime)
92 : "Alarm Disabled"92 : "Alarm Disabled"
9393
94 function animateTextChange() {94 function animateTextChange() {
@@ -107,7 +107,7 @@
107107
108 ScriptAction {108 ScriptAction {
109 script: alarmSubtitle.text = showAlarmFrequency ? alarmUtils.format_day_string(daysOfWeek, type)109 script: alarmSubtitle.text = showAlarmFrequency ? alarmUtils.format_day_string(daysOfWeek, type)
110 : alarmUtils.get_time_to_next_alarm(model.date - localTime)110 : alarmUtils.get_time_to_alarm(model.date, localTime)
111 }111 }
112112
113 PropertyAnimation {113 PropertyAnimation {
114114
=== modified file 'app/alarm/AlarmUtils.qml'
--- app/alarm/AlarmUtils.qml 2015-10-08 21:49:48 +0000
+++ app/alarm/AlarmUtils.qml 2015-10-29 22:15:16 +0000
@@ -79,12 +79,26 @@
79 return bottom_edge_title79 return bottom_edge_title
80 }80 }
8181
82 bottom_edge_title = i18n.tr("Next Alarm %1").arg(get_time_to_next_alarm(activeAlarmDate - clockTime))82 bottom_edge_title = i18n.tr("Next Alarm %1").arg(get_time_to_alarm(activeAlarmDate, clockTime))
83 return bottom_edge_title83 return bottom_edge_title
84 }84 }
8585
86 // Function to format the time to next alarm into a string86 function get_utc_time(dateTime) {
87 function get_time_to_next_alarm(totalTime) {87 return new Date(dateTime.getUTCFullYear(),
88 dateTime.getUTCMonth(),
89 dateTime.getUTCDate(),
90 dateTime.getUTCHours(),
91 dateTime.getUTCMinutes(),
92 dateTime.getUTCSeconds(),
93 dateTime.getUTCMilliseconds())
94 }
95
96 // Function to format the time to specific alarm into a string
97 function get_time_to_alarm(alarmDate, currentDateTime) {
98 // Discard the time and time-zone information, so it will be properly calculate time,
99 // even with different timezones (eg. during daylight saving change)
100 var totalTime = get_utc_time(alarmDate) - get_utc_time(currentDateTime);
101
88 if(totalTime < 0) {102 if(totalTime < 0) {
89 return i18n.tr("Alarm Passed")103 return i18n.tr("Alarm Passed")
90 }104 }
91105
=== modified file 'app/worldclock/WorldCityList.qml'
--- app/worldclock/WorldCityList.qml 2015-09-17 05:36:41 +0000
+++ app/worldclock/WorldCityList.qml 2015-10-29 22:15:16 +0000
@@ -124,7 +124,7 @@
124 var url = String("%1%2%3")124 var url = String("%1%2%3")
125 .arg("http://geoname-lookup.ubuntu.com/?query=")125 .arg("http://geoname-lookup.ubuntu.com/?query=")
126 .arg(searchField.text)126 .arg(searchField.text)
127 .arg("&app=com.ubuntu.clock&version=3.6.x")127 .arg("&app=com.ubuntu.clock&version=3.7.x")
128 console.log("Online URL: " + url)128 console.log("Online URL: " + url)
129 if (jsonTimeZoneModelLoader.status === Loader.Ready) {129 if (jsonTimeZoneModelLoader.status === Loader.Ready) {
130 jsonTimeZoneModel.source = Qt.resolvedUrl(url)130 jsonTimeZoneModel.source = Qt.resolvedUrl(url)
131131
=== modified file 'debian/changelog'
--- debian/changelog 2015-10-16 05:58:01 +0000
+++ debian/changelog 2015-10-29 22:15:16 +0000
@@ -1,4 +1,11 @@
1ubuntu-clock-app (3.6) UNRELEASED; urgency=medium1ubuntu-clock-app (3.7) UNRELEASED; urgency=medium
2
3 [ Bartosz Kosiorek ]
4 * Fix alarm difference time description, during DST change (LP: #1510694)
5
6 -- Bartosz Kosiorek <gang65@poczta.onet.pl> Tue, 27 Oct 2015 23:49:19 +0100
7
8ubuntu-clock-app (3.6) vivid; urgency=medium
29
3 [ Nekhelesh Ramananthan ]10 [ Nekhelesh Ramananthan ]
4 * Bumped version to 3.611 * Bumped version to 3.6
512
=== modified file 'manifest.json.in'
--- manifest.json.in 2015-09-03 21:07:54 +0000
+++ manifest.json.in 2015-10-29 22:15:16 +0000
@@ -12,7 +12,7 @@
12 "urls": "share/url-dispatcher/urls/com.ubuntu.clock_clock.url-dispatcher"12 "urls": "share/url-dispatcher/urls/com.ubuntu.clock_clock.url-dispatcher"
13 }13 }
14 },14 },
15 "version": "3.6.@BZR_REVNO@",15 "version": "3.7.@BZR_REVNO@",
16 "maintainer": "Ubuntu App Cats <ubuntu-touch-coreapps@lists.launchpad.net>",16 "maintainer": "Ubuntu App Cats <ubuntu-touch-coreapps@lists.launchpad.net>",
17 "x-test": {17 "x-test": {
18 "autopilot": {18 "autopilot": {
1919
=== modified file 'tests/unit/tst_alarm.qml'
--- tests/unit/tst_alarm.qml 2015-09-17 06:28:20 +0000
+++ tests/unit/tst_alarm.qml 2015-10-29 22:15:16 +0000
@@ -65,13 +65,16 @@
65 //delete all current alarms65 //delete all current alarms
66 waitForRendering(alarmPage)66 waitForRendering(alarmPage)
67 var alarmsList = findChild(alarmPage, "alarmListView")67 var alarmsList = findChild(alarmPage, "alarmListView")
68 verify(alarmsList != null)68 verify(alarmsList !== null)
69 print("Found " + alarmsList.count + " pre-existing alarms")69 print("Found " + alarmsList.count + " pre-existing alarms")
7070
71 for (var i=0; i<alarmsList.count; i++) {71 for (var i=0; i<alarmsList.count; i++) {
72 print("Deleting Alarm " + i)72
73 var alarmObject = findChild(alarmsList, "alarm"+i)73 var alarmObject = findChild(alarmsList, "alarm"+i)
74 swipeToDeleteItem(alarmObject)74 if (alarmObject !== null) {
75 print("Deleting Alarm " + i)
76 swipeToDeleteItem(alarmObject)
77 }
75 waitForRendering(alarmPage)78 waitForRendering(alarmPage)
76 }79 }
77 }80 }
7881
=== modified file 'tests/unit/tst_alarmUtils.qml'
--- tests/unit/tst_alarmUtils.qml 2015-10-08 20:17:11 +0000
+++ tests/unit/tst_alarmUtils.qml 2015-10-29 22:15:16 +0000
@@ -25,9 +25,7 @@
25 id: alarmUtilsTest25 id: alarmUtilsTest
26 name: "AlarmUtilsLibrary"26 name: "AlarmUtilsLibrary"
2727
28 property var futureTime: new Date()28 property string mock_notLocalizedDateTimeString: ""
29 property var currentTime: new Date()
30 property var mock_notLocalizedDateTimeString: ""
3129
32 AlarmUtils {30 AlarmUtils {
33 id: alarmUtils31 id: alarmUtils
@@ -45,6 +43,9 @@
45 Alarm1, currentTime+2hrs, not enabled43 Alarm1, currentTime+2hrs, not enabled
46 Alarm2, currentTime+7hrs, enabled44 Alarm2, currentTime+7hrs, enabled
47 */45 */
46
47 var currentTime = new Date()
48 var futureTime = new Date()
48 futureTime.setHours((futureTime.getHours() + 2))49 futureTime.setHours((futureTime.getHours() + 2))
49 mockAlarmDatabase.append({"name": "Alarm1", "date": futureTime, "enabled": false})50 mockAlarmDatabase.append({"name": "Alarm1", "date": futureTime, "enabled": false})
50 futureTime.setHours((futureTime.getHours() + 5))51 futureTime.setHours((futureTime.getHours() + 5))
@@ -96,35 +97,42 @@
96 }97 }
9798
98 /*99 /*
99 This test checks if the get_time_to_next_alarm() function takes a time in100 This test checks if the get_time_to_alarm() function takes a time in
100 milliseconds and writtens a user readable string e.g "in 2d 15h 10m" after101 milliseconds and writtens a user readable string e.g "in 2d 15h 10m" after
101 correct calculation.102 correct calculation.
102 */103 */
103 function test_timeToNextAlarmStringMustShowAll() {104 function test_timeToNextAlarmStringMustShowAll() {
104 var timeInMilliseconds = 440100000; // 5 days, 2 hrs, 16 mins105 var currentDateTime = new Date()
105 var result = alarmUtils.get_time_to_next_alarm(timeInMilliseconds)106 var timeInMilliseconds = ((5 * 24 + 2)* 60 + 15) * 60 * 1000; // 5 days, 2 hrs, 16 mins
107
108 var alarmDate = new Date(currentDateTime.getTime() + timeInMilliseconds);
109 var result = alarmUtils.get_time_to_alarm(alarmDate, currentDateTime)
106 compare(result, "in 5d 2h 16m", "Time to next alarm string is incorrect")110 compare(result, "in 5d 2h 16m", "Time to next alarm string is incorrect")
107 }111 }
108112
109 /*113 /*
110 This test checks if the get_time_to_next_alarm() function takes a time in114 This test checks if the get_time_to_alarm() function takes a time in
111 milliseconds and writtens a user readable string without days e.g "in 15h 10m"115 milliseconds and writtens a user readable string without days e.g "in 15h 10m"
112 after correct calculation.116 after correct calculation.
113 */117 */
114 function test_timeToNextAlarmStringMustNotShowDays() {118 function test_timeToNextAlarmStringMustNotShowDays() {
115 var timeInMilliseconds = 36000000 // 10 hours, 1 min119 var timeInMilliseconds = 10 * 60 * 60 * 1000 // 10 hours, 1 min
116 var result = alarmUtils.get_time_to_next_alarm(timeInMilliseconds)120 var currentDateTime = new Date()
121 var alarmDate = new Date(currentDateTime.getTime() + timeInMilliseconds);
122 var result = alarmUtils.get_time_to_alarm(alarmDate, currentDateTime)
117 compare(result, "in 10h 1m", "Time to next alarm string is incorrect")123 compare(result, "in 10h 1m", "Time to next alarm string is incorrect")
118 }124 }
119125
120 /*126 /*
121 This test checks if the get_time_to_next_alarm() function takes a time in127 This test checks if the get_time_to_alarm() function takes a time in
122 milliseconds and writtens a user readable string with only mins e.g "in 10m"128 milliseconds and writtens a user readable string with only mins e.g "in 10m"
123 after correct calculation.129 after correct calculation.
124 */130 */
125 function test_timeToNextAlarmStringMustOnlyShowMinutes() {131 function test_timeToNextAlarmStringMustOnlyShowMinutes() {
126 var timeInMilliseconds = 1080000 // 19 mins132 var timeInMilliseconds = 18 * 60 * 1000 // 19 mins
127 var result = alarmUtils.get_time_to_next_alarm(timeInMilliseconds)133 var currentDateTime = new Date()
134 var alarmDate = new Date(currentDateTime.getTime() + timeInMilliseconds);
135 var result = alarmUtils.get_time_to_alarm(alarmDate, currentDateTime)
128 compare(result, "in 19m", "Time to next alarm string is incorrect")136 compare(result, "in 19m", "Time to next alarm string is incorrect")
129 }137 }
130138

Subscribers

People subscribed via source and target branches