← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~gary-wzl77/ubuntu-calendar-app/fix_1515722 into lp:ubuntu-calendar-app

 

Gary.Wang has proposed merging lp:~gary-wzl77/ubuntu-calendar-app/fix_1515722 into lp:ubuntu-calendar-app.

Commit message:
1.Correct duration calculation when to check overlapping of event display
2.Simplify event display bubble calculation in timeline


Requested reviews:
  Ubuntu Calendar Developers (ubuntu-calendar-dev)

For more details, see:
https://code.launchpad.net/~gary-wzl77/ubuntu-calendar-app/fix_1515722/+merge/278759

1.Correct duration calculation when to check overlapping of event display
2.Simplify event display bubble calculation in timeline

-- 
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~gary-wzl77/ubuntu-calendar-app/fix_1515722 into lp:ubuntu-calendar-app.
=== modified file 'EventLayoutHelper.js'
--- EventLayoutHelper.js	2014-08-18 16:48:54 +0000
+++ EventLayoutHelper.js	2015-11-27 01:49:25 +0000
@@ -37,24 +37,13 @@
     }
 }
 
-
-function getMinutes(time) {
-    return time.getHours() * 60 + time.getMinutes();
-}
-
-function getDuration(event) {
-    var start = getMinutes(event.startDateTime);
-    var end = getMinutes(event.endDateTime);
-    return end - start;
-}
-
 function processEvents(events) {
     var array = [];
     for( var i = 0; i < events.length ; ++i) {
         var event = events[i]
         var sch = {};
-        sch["start"] = getMinutes(event.startDateTime);
-        sch["duration"] = getDuration(event);
+        sch["start"] = event.startDateTime.getTime()
+        sch["duration"] = event.endDateTime - event.startDateTime
         sch["id"] = event.id;
         sch["depth"] = 0;
         sortedInsert(array,sch);

=== modified file 'TimeLineBase.qml'
--- TimeLineBase.qml	2015-08-20 12:27:59 +0000
+++ TimeLineBase.qml	2015-11-27 01:49:25 +0000
@@ -221,28 +221,27 @@
         if (event.endDateTime - day  == 0)
             return;
 
-        if (event.endDateTime.getDate() - day.getDate() == 0 &&
-                event.startDateTime.getDate() - day.getDate() == 0) {
+        if (event.endDateTime.isSameDay(day) &&
+                event.endDateTime.isSameDay(event.startDateTime)) {
             hour = event.startDateTime.getHours();
             yPos = (( event.startDateTime.getMinutes() * hourHeight) / 60) + hour * hourHeight
-            durationMin = (event.endDateTime.getHours() - event.startDateTime.getHours()) * 60;
-            durationMin += (event.endDateTime.getMinutes() - event.startDateTime.getMinutes());
+            durationMin = (event.endDateTime - event.startDateTime)  / Date.msPerMin;
         }
-        if (event.endDateTime.getDate() - day.getDate() == 0 &&
-                event.startDateTime - day < 0) {
+        if (!event.startDateTime.isSameDay(day) &&
+                event.endDateTime.isSameDay(day)) {
             hour = 0;
             yPos = 0;
             durationMin = event.endDateTime.getHours() * 60;
             durationMin += event.endDateTime.getMinutes();
         }
-        if (event.startDateTime.getDate() - day.getDate() == 0 &&
-                event.endDateTime - day >= Date.msPerDay) {
+        if (event.startDateTime.isSameDay(day) &&
+                !event.endDateTime.isSameDay(day)) {
             hour = event.startDateTime.getHours();
             yPos = (( event.startDateTime.getMinutes() * hourHeight) / 60) + hour * hourHeight
             durationMin = (24 - event.startDateTime.getHours()) * 60;
         }
-        if (event.endDateTime - day  >= Date.msPerDay &&
-                event.startDateTime- day <= 0) {
+        if (!event.startDateTime.isSameDay(day) &&
+                !event.endDateTime.isSameDay(day)) {
             hour = 0;
             yPos = 0;
             durationMin = 24 * 60;

=== modified file 'dateExt.js'
--- dateExt.js	2015-09-05 05:30:23 +0000
+++ dateExt.js	2015-11-27 01:49:25 +0000
@@ -17,6 +17,7 @@
  */
 .pragma library
 
+Date.msPerMin = 60000
 Date.msPerDay = 86400e3
 Date.msPerWeek = Date.msPerDay * 7
 

=== modified file 'po/com.ubuntu.calendar.pot'
--- po/com.ubuntu.calendar.pot	2015-11-23 07:15:20 +0000
+++ po/com.ubuntu.calendar.pot	2015-11-27 01:49:25 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-11-23 15:14+0800\n"
+"POT-Creation-Date: 2015-11-27 09:28+0800\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