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

Proposed by Bartosz Kosiorek
Status: Merged
Approved by: Bartosz Kosiorek
Approved revision: 437
Merged at revision: 435
Proposed branch: lp:~gang65/ubuntu-clock-app/ubuntu-clock-app-alarm-label-fix
Merge into: lp:ubuntu-clock-app
Diff against target: 119 lines (+24/-45)
2 files modified
app/alarm/AlarmDelegate.qml (+21/-43)
debian/changelog (+3/-2)
To merge this branch: bzr merge lp:~gang65/ubuntu-clock-app/ubuntu-clock-app-alarm-label-fix
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve
Victor Thompson Needs Fixing
Review via email: mp+281414@code.launchpad.net

Commit message

Fix race condition, which cause wrong alarm caption (LP: #1530000)

Description of the change

Fix race condition, which cause wrong alarm caption (LP: #1530000)

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
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

* What is a "rat condition"? Could you clarify please and fix the applicable commit/change logs as applicable?
* Please remove the extra asterisk in the changelog.
* Could you add specific steps to reproduce to the bug report?

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

1. I added inline comments. Generally we shouldn't process alarm when (model.status !== Alarm.Ready)
In most cases changing model.status to Alarm.Ready is fast. But in rare cases, Alarm will be parsed faster when it is not ready. It is causing "Alarm disabled" issue.
2. Thanks done
3. I have added description to bug report

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
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: Needs Fixing (continuous-integration)
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) :
review: Approve (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
Merging failed. More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/run-ap-tests-autolanding/853/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1572/console

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

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/clock-app-autolanding/255/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1575/console

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

Merge with trunk

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) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/alarm/AlarmDelegate.qml'
2--- app/alarm/AlarmDelegate.qml 2015-12-11 02:13:16 +0000
3+++ app/alarm/AlarmDelegate.qml 2016-02-02 23:46:24 +0000
4@@ -56,7 +56,7 @@
5
6 color: UbuntuColors.midAubergine
7 fontSize: "x-large"
8- text: Qt.formatTime(date)
9+ text: Qt.formatTime(model.date)
10 }
11
12 RowLayout {
13@@ -85,11 +85,10 @@
14
15 fontSize: "small"
16 Layout.fillWidth: true
17- visible: !(type === Alarm.OneTime && !model.enabled)
18+ visible: ((type === Alarm.Repeating) || model.enabled) && (model.status === Alarm.Ready)
19 elide: Text.ElideRight
20- text: type === Alarm.Repeating ? alarmUtils.format_day_string(daysOfWeek, type)
21- : model.enabled ? alarmUtils.get_time_to_alarm(model.date, localTime)
22- : "Alarm Disabled"
23+ text: type === Alarm.Repeating ? alarmUtils.format_day_string(daysOfWeek, type) :
24+ alarmUtils.get_time_to_alarm(model.date, localTime)
25
26 function animateTextChange() {
27 textChangeAnimation.start()
28@@ -124,6 +123,7 @@
29 Switch {
30 id: alarmStatus
31 objectName: "listAlarmStatus" + index
32+ checked: model.enabled && (model.status === Alarm.Ready)
33
34 anchors {
35 right: parent.right
36@@ -133,48 +133,26 @@
37
38 onCheckedChanged: {
39 if (checked !== model.enabled) {
40- var alarmData = model
41- alarmData.enabled = checked
42-
43 /*
44 Calculate the alarm time if it is a one-time alarm.
45 Repeating alarms do this automatically.
46 */
47 if(type === Alarm.OneTime) {
48- alarmData.daysOfWeek = Alarm.AutoDetect
49- var now = new Date()
50- if (alarmData.date.getHours()*60+alarmData.date.getMinutes() <= now.getHours()*60+now.getMinutes()) {
51- alarmData.date = new Date(now.getFullYear(), now.getMonth(), now.getDate()+1, alarmData.date.getHours(), alarmData.date.getMinutes(), 0, 0)
52- } else {
53- alarmData.date = new Date(now.getFullYear(), now.getMonth(), now.getDate(), alarmData.date.getHours(), alarmData.date.getMinutes(), 0, 0)
54- }
55- }
56-
57- alarmData.save()
58- }
59- }
60-
61- Connections {
62- target: model
63- onStatusChanged: {
64- /*
65- Update switch value only when the alarm save() operation
66- is complete to avoid switching it back.
67- */
68- if (model.status === Alarm.Ready) {
69- alarmStatus.checked = model.enabled;
70-
71- if (!alarmStatus.checked && type === Alarm.Repeating) {
72- alarmSubtitle.text = alarmUtils.format_day_string(daysOfWeek, type)
73- }
74- }
75- }
76- }
77-
78- /*
79- Assign switch value only once at startup. After this, the switch will
80- be updated after the alarm save() operations only.
81- */
82- Component.onCompleted: alarmStatus.checked = model.enabled
83+ var date = new Date()
84+ date.setHours(model.date.getHours(), model.date.getMinutes(), 0)
85+
86+ model.daysOfWeek = Alarm.AutoDetect
87+ if (date < new Date()) {
88+ var tomorrow = new Date()
89+ tomorrow.setDate(tomorrow.getDate() + 1)
90+ model.daysOfWeek = alarmUtils.get_alarm_day(tomorrow.getDay())
91+ }
92+ model.date = date
93+
94+ }
95+ model.enabled = checked
96+ model.save()
97+ }
98+ }
99 }
100 }
101
102=== modified file 'debian/changelog'
103--- debian/changelog 2016-01-19 01:29:52 +0000
104+++ debian/changelog 2016-02-02 23:46:24 +0000
105@@ -3,12 +3,13 @@
106 [ Bartosz Kosiorek ]
107 * Fix alarm difference time description, during DST change (LP: #1510694)
108 * Move to use the new SDK components v1.3 (LP: #1508363)
109- * Fix continously move the alarm volume slider to the desired value (LP: #1492584)
110+ * Fix continously move the alarm volume slider to the desired value (LP: #1492584)
111+ * Fix wrong alarm caption which appears during high load (LP: #1530000)
112
113 [ Andrew Hayzen ]
114 * Fixes for various autopilot issues (LP: #1535488)
115
116- -- Bartosz Kosiorek <gang65@poczta.onet.pl> Wed, 16 Dec 2015 22:44:49 +0100
117+ -- Bartosz Kosiorek <gang65@poczta.onet.pl> Wed, 30 Dec 2015 01:43:24 +0100
118
119 ubuntu-clock-app (3.6) vivid; urgency=medium
120

Subscribers

People subscribed via source and target branches