Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4781 from toggl-open-source/fix/timeline_ui/top_e…
Browse files Browse the repository at this point in the history
…dge_resizing

Use keepEndTimeFixed option everywhere in Timeline UI (win)
  • Loading branch information
skel35 authored Dec 24, 2020
2 parents 8ed93a6 + 7484b0b commit 359d565
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/ui/windows/TogglDesktop/TogglDesktop/Toggl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,14 @@ public static bool SetTimeEntryStartTimeStamp(string guid, long timeStamp)
}
}

public static bool SetTimeEntryStartTimeStampWithOption(string guid, long timeStamp, bool keepEndTimeFixed)
{
using (Performance.Measure("changing time entry start time stamp"))
{
return toggl_set_time_entry_start_timestamp_with_option(ctx, guid, timeStamp, keepEndTimeFixed);
}
}

public static bool SetTimeEntryEndTimeStamp(string guid, long timeStamp)
{
using (Performance.Measure("changing time entry end time stamp"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public TimeEntryBlock(Toggl.TogglTimeEntryView te, int hourHeight, DateTime date

public void ChangeStartTime()
{
Toggl.SetTimeEntryStartTimeStamp(TimeEntryId,
(long)TimelineUtils.ConvertOffsetToUnixTime(VerticalOffset, DateCreated, _hourHeight));
Toggl.SetTimeEntryStartTimeStampWithOption(TimeEntryId,
(long)TimelineUtils.ConvertOffsetToUnixTime(VerticalOffset, DateCreated, _hourHeight), true);
}

public void ChangeEndTime()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ private static GapTimeEntryBlock GenerateRunningGapBlock(IEnumerable<TimeEntryBl
(offset, height) =>
{
var id = Toggl.Start("", "", 0, 0, "", "");
Toggl.SetTimeEntryStartTimeStamp(id, (long)lastTimeEntry.Ended+1);
Toggl.SetTimeEntryStartTimeStampWithOption(id, (long)lastTimeEntry.Ended+1, true);
return id;
})
{
Expand Down Expand Up @@ -374,7 +374,7 @@ public static void ChangeLastEntryStart(TimeEntryBlock item, List<TimeEntryBlock
{
var (first, last) = GetOverlappingPair(item, blocks);
if (last == null) return;
Toggl.SetTimeEntryStartTimeStamp(last.TimeEntryId, (long)first.Ended);
Toggl.SetTimeEntryStartTimeStampWithOption(last.TimeEntryId, (long)first.Ended, true);
}

private static (TimeEntryBlock First, TimeEntryBlock Last) GetOverlappingPair(TimeEntryBlock item, IEnumerable<TimeEntryBlock> blocks)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static DateTime ConvertOffsetToDateTime(double height, DateTime date, dou
public static void CreateAndEditRunningTimeEntryFrom(ulong started)
{
var teId = Toggl.Start("", "", 0, 0, "", "");
Toggl.SetTimeEntryStartTimeStamp(teId, (long)started);
Toggl.SetTimeEntryStartTimeStampWithOption(teId, (long)started, true);
Toggl.Edit(teId, true, Toggl.Description);
}

Expand Down

0 comments on commit 359d565

Please sign in to comment.