Check-in [a382835d86]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:DAT2ICS: curtail all activities that carry on past the start of another activity.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a382835d86b623828e89d1ac0198187a3cdb68e4
User & Date: tinus 2015-06-01 15:52:40.761
Context
2015-11-28
15:37
New attempt to write a completely new project button app, this time in Lazarus and FPC. check-in: 5bb550990e user: tinus tags: projectit-laz
2015-06-01
15:52
DAT2ICS: curtail all activities that carry on past the start of another activity. Leaf check-in: a382835d86 user: tinus tags: trunk
2015-05-18
10:55
Dat2ICS: report all breaks shorter than 5 hours. check-in: 4ce807ef35 user: tinus tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to DAT2ICS/src/ProjectIt_dat2ics.dpr.
113
114
115
116
117
118
119















120
121
122
123
124
125
126
      DB.BeginTransaction;
      DB.Execute('UPDATE Activities SET duration = ?1, current = 1 WHERE id = ?2',
                  [SecondsBetween(Now, dtDummy), ID]);
      DB.Execute('UPDATE Activities SET current = 0 WHERE id != ?', [ID]);
      DB.Commit;
    end;
  end;















end {LoadData};

{ ------------------------------------------------------------------------------------------------ }
function ExportToICS(const DB: TSQLiteDatabase; const ICSFilename: TFilename): Integer;
var
  SB: TStringBuilder;
  Rows: TCustomSQLiteCursor;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
      DB.BeginTransaction;
      DB.Execute('UPDATE Activities SET duration = ?1, current = 1 WHERE id = ?2',
                  [SecondsBetween(Now, dtDummy), ID]);
      DB.Execute('UPDATE Activities SET current = 0 WHERE id != ?', [ID]);
      DB.Commit;
    end;
  end;

  {--- MCO 01-06-2015: alle activities kortwieken die voorbij de
                        startdatum van een andere activity lopen ---}
  DB.Execute(' UPDATE Activities'
            + '   SET duration = CAST(round(((SELECT MIN(a2.start)'
            + '                                 FROM Activities a2'
            + '                                WHERE Activities.start < a2.start'
            + '                                  AND datetime(a2.start) < datetime(Activities.start, "+" || Activities.duration || " seconds")'
            + '                                  ) - Activities.start) * 86400) AS INTEGER)'
            + ' WHERE id IN (SELECT a1.id'
            + '                FROM Activities a1'
            + '                     INNER JOIN Activities a2'
            + '                             ON a1.start < a2.start'
            + '                            AND datetime(a2.start) < datetime(a1.start, "+" || a1.duration || " seconds"))'
            + ';');
end {LoadData};

{ ------------------------------------------------------------------------------------------------ }
function ExportToICS(const DB: TSQLiteDatabase; const ICSFilename: TFilename): Integer;
var
  SB: TStringBuilder;
  Rows: TCustomSQLiteCursor;