Merge lp:~pkunal-parmar/ubuntu-calendar-app/TapToCreateEvent into lp:ubuntu-calendar-app

Proposed by Kunal Parmar
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 631
Merged at revision: 646
Proposed branch: lp:~pkunal-parmar/ubuntu-calendar-app/TapToCreateEvent
Merge into: lp:ubuntu-calendar-app
Diff against target: 164 lines (+47/-12)
6 files modified
NewEvent.qml (+6/-0)
TimeLineBase.qml (+15/-2)
TimeLineBaseComponent.qml (+7/-1)
WeekView.qml (+0/-7)
tests/autopilot/calendar_app/tests/test_monthview.py (+5/-0)
tests/autopilot/calendar_app/tests/test_weekview.py (+14/-2)
To merge this branch: bzr merge lp:~pkunal-parmar/ubuntu-calendar-app/TapToCreateEvent
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Nicholas Skaggs (community) Needs Fixing
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Needs Fixing
Review via email: mp+254175@code.launchpad.net

Commit message

Resolves Bug #1378380
Add event on tap

Description of the change

Resolves Bug #1378380
Add event on tap

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Tapping created an event at 21:26, I think it should create an event which locks to the nearest 30 minutes.

The event is created, and then two more button presses are required (tap event, tap edit) to edit the event to change the title from "Untitled". Would it make more sense to go directly to edit event when created?

Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

> Tapping created an event at 21:26, I think it should create an event which
> locks to the nearest 30 minutes.
>

As per current implementation we are truncating minutes and creating event for currently touched hour.
It should have created event rounding to hour, for your case it should have created event on 21:00 to 22:00

Can you confirm once more ?

> The event is created, and then two more button presses are required (tap
> event, tap edit) to edit the event to change the title from "Untitled". Would
> it make more sense to go directly to edit event when created?

This can be done

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

so issue with jenkins was, first day was not visible but AP was trying to click on first day, which it could not see and thus AP fails.

Now scrolling view to make first day visible.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Tested and this is great, thanks!

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

testtools.matchers._impl.MismatchError: !=:
reference = datetime.datetime(2015, 4, 12, 22, 0)
actual = datetime.datetime(2015, 4, 12, 21, 30)

So we create an event on the half hour but the test always assumes it's on the hour, so that needs fixing.

review: Needs Fixing
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

Sure, I'll fix this and other ap fail with week number Mr.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

From Video, test case seems to be running fine. There seems some issue with Jenkins server. Seems like python is getting some wrong date.

like in below log,
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/calendar_app/tests/test_monthview.py", line 142, in test_today_button
    self._go_to_today(1)
  File "/usr/lib/python3/dist-packages/calendar_app/tests/test_monthview.py", line 87, in _go_to_today
    self._assert_today()
  File "/usr/lib/python3/dist-packages/calendar_app/tests/test_monthview.py", line 74, in _assert_today
    Eventually(Equals(today.day)))
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 423, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: After 10.0 seconds test failed: 16 != 1

as you can see from failure, fail happens on 16th April, so today is 16, but python is expecting 1.
Which is wrong.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kunal Parmar (pkunal-parmar) wrote :

It was once approved by Alan so approving it again

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Kunal, ideally we should have a test that covers tapping to create an event. Since event creation is well covered, this test could be written easily enough by opening the dayview and tapping under a few scenarios (on an event, on a blank timeslot, between slots), ensuring the proper response for each.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Some suggested changes.

review: Needs Fixing
626. By Kunal Parmar

logging

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
627. By Kunal Parmar

typo resolved

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
628. By Kunal Parmar

AP fix

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
629. By Kunal Parmar

ap fix

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
630. By Kunal Parmar

AP fix by selecting today

631. By Kunal Parmar

pep8

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-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
1=== modified file 'NewEvent.qml'
2--- NewEvent.qml 2015-04-05 04:54:54 +0000
3+++ NewEvent.qml 2015-05-09 02:20:28 +0000
4@@ -217,6 +217,12 @@
5 event.setDetail(audibleReminder);
6 }
7 event.collectionId = calendarsOption.model[calendarsOption.selectedIndex].collectionId;
8+
9+ var comment = event.detail(Detail.Comment);
10+ if(comment && comment.comment === "X-CAL-DEFAULT-EVENT") {
11+ event.removeDetail(comment);
12+ }
13+
14 model.saveItem(event);
15 pageStack.pop();
16 root.eventAdded(event);
17
18=== modified file 'TimeLineBase.qml'
19--- TimeLineBase.qml 2015-01-22 21:17:51 +0000
20+++ TimeLineBase.qml 2015-05-09 02:20:28 +0000
21@@ -36,11 +36,18 @@
22 MouseArea {
23 anchors.fill: parent
24 objectName: "mouseArea"
25+
26+ onClicked: {
27+ var selectedDate = new Date(day);
28+ var hour = parseInt(mouseY / hourHeight);
29+ selectedDate.setHours(hour)
30+ createOrganizerEvent(selectedDate);
31+ }
32+
33 onPressAndHold: {
34 var selectedDate = new Date(day);
35 var hour = parseInt(mouseY / hourHeight);
36 selectedDate.setHours(hour)
37- //pageStack.push(Qt.resolvedUrl("NewEvent.qml"), {"date":selectedDate, "model":eventModel});
38 createOrganizerEvent(selectedDate);
39 }
40
41@@ -71,6 +78,7 @@
42 event.startDateTime = startDate;
43 event.endDateTime = endDate;
44 event.displayLabel = i18n.tr("Untitled");
45+ event.setDetail(Qt.createQmlObject("import QtOrganizer 5.0; Comment{ comment: 'X-CAL-DEFAULT-EVENT'}", event,"TimeLineBase.qml"));
46 model.saveItem(event);
47 }
48
49@@ -90,7 +98,12 @@
50 }
51
52 function showEventDetails(event) {
53- pageStack.push(Qt.resolvedUrl("EventDetails.qml"), {"event":event,"model":model});
54+ var comment = event.detail(Detail.Comment);
55+ if(comment && comment.comment === "X-CAL-DEFAULT-EVENT") {
56+ pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"event": event, "model":model});
57+ } else {
58+ pageStack.push(Qt.resolvedUrl("EventDetails.qml"), {"event":event,"model":model});
59+ }
60 }
61
62 WorkerScript {
63
64=== modified file 'TimeLineBaseComponent.qml'
65--- TimeLineBaseComponent.qml 2015-02-19 13:50:29 +0000
66+++ TimeLineBaseComponent.qml 2015-05-09 02:20:28 +0000
67@@ -63,8 +63,9 @@
68 var today = DateExt.today();
69 var startOfWeek = today.weekStart(Qt.locale().firstDayOfWeek);
70 var weekDay = today.getDay();
71+
72 if( startOfWeek.isSameDay(startDay) && weekDay > 2) {
73- timeLineView.contentX = (weekDay * timeLineView.delegateWidth);
74+ timeLineView.contentX = (weekDay * timeLineView.delegateWidth);
75 if( timeLineView.contentX > (timeLineView.contentWidth - timeLineView.width) ) {
76 timeLineView.contentX = timeLineView.contentWidth - timeLineView.width
77 }
78@@ -182,6 +183,11 @@
79 }
80 }
81
82+ onContentWidthChanged: {
83+ scrollToCurrentTime();
84+ scrollTocurrentDate();
85+ }
86+
87 clip: true
88
89 TimeLineBackground{}
90
91=== modified file 'WeekView.qml'
92--- WeekView.qml 2015-02-26 16:44:43 +0000
93+++ WeekView.qml 2015-05-09 02:20:28 +0000
94@@ -107,13 +107,6 @@
95 startDay: firstDay.addDays( weekViewPath.indexType(index) * 7)
96 keyboardEventProvider: weekViewPath
97
98- Component.onCompleted: {
99- if(weekViewPage.isCurrentPage){
100- timeLineView.scrollToCurrentTime();
101- timeLineView.scrollTocurrentDate();
102- }
103- }
104-
105 onIsActiveChanged: {
106 timeLineView.scrollTocurrentDate();
107 }
108
109=== modified file 'tests/autopilot/calendar_app/tests/test_monthview.py'
110--- tests/autopilot/calendar_app/tests/test_monthview.py 2015-04-06 17:07:11 +0000
111+++ tests/autopilot/calendar_app/tests/test_monthview.py 2015-05-09 02:20:28 +0000
112@@ -29,6 +29,9 @@
113 from datetime import datetime
114 from dateutil.relativedelta import relativedelta
115
116+import logging
117+logger = logging.getLogger(__name__)
118+
119
120 class TestMonthView(CalendarAppTestCase):
121
122@@ -69,6 +72,8 @@
123 local = self.app.main_view.to_local_date(
124 self.month_view.currentMonth.datetime)
125 today = datetime.now()
126+ logger.debug(local)
127+ logger.debug(today)
128
129 self.assertThat(lambda: local.day,
130 Eventually(Equals(today.day)))
131
132=== modified file 'tests/autopilot/calendar_app/tests/test_weekview.py'
133--- tests/autopilot/calendar_app/tests/test_weekview.py 2015-04-10 18:50:59 +0000
134+++ tests/autopilot/calendar_app/tests/test_weekview.py 2015-05-09 02:20:28 +0000
135@@ -157,8 +157,16 @@
136 def test_selecting_a_day_switches_to_day_view(self):
137 """It must be possible to show a single day by clicking on it."""
138 days = self.week_view.get_days_of_week()
139- day_to_select = self.app.main_view.get_label_with_text(days[0])
140- expected_day = days[0]
141+ today = datetime.datetime.now()
142+
143+ # selecting today
144+ index = 0
145+ for i in range(len(days)):
146+ if days[i] == today.day:
147+ index = i
148+
149+ day_to_select = self.app.main_view.get_label_with_text(days[index])
150+ expected_day = days[index]
151 dayStart = self.week_view.firstDay
152 expected_month = dayStart.month
153 expected_year = dayStart.year
154@@ -172,6 +180,10 @@
155 # Check that the 'Day' view is on the correct/selected day.
156 selected_date = \
157 self.app.main_view.get_day_view().get_selected_day().startDay
158+
159+ logger.debug(expected_day)
160+ logger.debug(selected_date)
161+
162 self.assertThat(expected_day, Equals(selected_date.day))
163 self.assertThat(expected_month, Equals(selected_date.month))
164 self.assertThat(expected_year, Equals(selected_date.year))

Subscribers

People subscribed via source and target branches

to status/vote changes: