Skip to content

Commit

Permalink
Merge branch 'main' into tgl-view
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNZL committed May 16, 2023
2 parents 861e77d + 2cc6564 commit a99d16e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [2.1.4](https://github.com/JamesNZL/flow-toggl-plugin/compare/v2.1.3...v2.1.4) (2023-05-16)


### Bug Fixes

* **ux:** :bug: fix incorrect time strings when longer than 1 day ([#6](https://github.com/JamesNZL/flow-toggl-plugin/issues/6)) ([58ed0e3](https://github.com/JamesNZL/flow-toggl-plugin/commit/58ed0e351ed43c8be6d5278eecf9332d930b2b36))

### [2.1.3](https://github.com/JamesNZL/flow-toggl-plugin/compare/v2.1.2...v2.1.3) (2023-05-15)


Expand Down
28 changes: 14 additions & 14 deletions src/TogglTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ internal async ValueTask<List<Result>> RequestEditEntry(CancellationToken token,
new Result
{
Title = (string.IsNullOrEmpty(description)) ? ((string.IsNullOrEmpty(runningTimeEntry.description)) ? "(no description)" : runningTimeEntry.description) : description,
SubTitle = $"{projectName} | {elapsed.Humanize()} ({elapsed.ToString(@"h\:mm\:ss")})",
SubTitle = $"{projectName} | {elapsed.Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Hour)} ({elapsed.TotalHours}:{elapsed.ToString(@"mm\:ss")})",
IcoPath = (project?.color is not null)
? new ColourIcon(this._context, project.color, "edit.png").GetColourIcon()
: "edit.png",
Expand All @@ -813,7 +813,7 @@ internal async ValueTask<List<Result>> RequestEditEntry(CancellationToken token,
throw new Exception("An API error was encountered.");
}
this._context.API.ShowMsg($"Edited {editedTimeEntry.description}", $"{projectName} | {elapsed.ToString(@"h\:mm\:ss")}", "edit.png");
this._context.API.ShowMsg($"Edited {editedTimeEntry.description}", $"{projectName} | {elapsed.TotalHours}:{elapsed.ToString(@"mm\:ss")}", "edit.png");
// Update cached running time entry state
_ = Task.Run(() =>
Expand Down Expand Up @@ -887,7 +887,7 @@ internal async ValueTask<List<Result>> RequestEditEntry(CancellationToken token,
results.Add(new Result
{
Title = (string.IsNullOrEmpty(sanitisedDescription)) ? ((string.IsNullOrEmpty(runningTimeEntry.description)) ? "(no description)" : runningTimeEntry.description) : sanitisedDescription,
SubTitle = $"{projectName} | {newElapsed.Humanize()} ({newElapsed.ToString(@"h\:mm\:ss")})",
SubTitle = $"{projectName} | {newElapsed.Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Hour)} ({newElapsed.TotalHours}:{newElapsed.ToString(@"mm\:ss")})",
IcoPath = (project?.color is not null)
? new ColourIcon(this._context, project.color, "edit.png").GetColourIcon()
: "edit.png",
Expand All @@ -907,7 +907,7 @@ internal async ValueTask<List<Result>> RequestEditEntry(CancellationToken token,
throw new Exception("An API error was encountered.");
}
this._context.API.ShowMsg($"Edited {editedTimeEntry.description}", $"{projectName} | {newElapsed.ToString(@"h\:mm\:ss")}", "edit.png");
this._context.API.ShowMsg($"Edited {editedTimeEntry.description}", $"{projectName} | {newElapsed.TotalHours}:{newElapsed.ToString(@"mm\:ss")}", "edit.png");
// Update cached running time entry state
_ = Task.Run(() =>
Expand Down Expand Up @@ -1023,7 +1023,7 @@ internal async ValueTask<List<Result>> RequestStopEntry(CancellationToken token,
new Result
{
Title = $"Stop {((string.IsNullOrEmpty(runningTimeEntry.description)) ? "(no description)" : runningTimeEntry.description)} now",
SubTitle = $"{projectName} | {elapsed.Humanize()} ({elapsed.ToString(@"h\:mm\:ss")})",
SubTitle = $"{projectName} | {elapsed.Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Hour)} ({elapsed.TotalHours}:{elapsed.ToString(@"mm\:ss")})",
IcoPath = (project?.color is not null)
? new ColourIcon(this._context, project.color, "stop.png").GetColourIcon()
: "stop.png",
Expand All @@ -1035,15 +1035,15 @@ internal async ValueTask<List<Result>> RequestStopEntry(CancellationToken token,
{
try
{
this._context.API.LogInfo("TogglTrack", $"{this._selectedProjectId}, {runningTimeEntry.id}, {runningTimeEntry.workspace_id}, {startDate}, {elapsed.ToString(@"h\:mm\:ss")}", "RequestStopEntry");
this._context.API.LogInfo("TogglTrack", $"{this._selectedProjectId}, {runningTimeEntry.id}, {runningTimeEntry.workspace_id}, {startDate}, {elapsed.TotalHours}:{elapsed.ToString(@"mm\:ss")}", "RequestStopEntry");
var stoppedTimeEntry = await this._client.StopTimeEntry(runningTimeEntry.id, runningTimeEntry.workspace_id);
if (stoppedTimeEntry?.id is null)
{
throw new Exception("An API error was encountered.");
}
this._context.API.ShowMsg($"Stopped {stoppedTimeEntry.description}", $"{elapsed.ToString(@"h\:mm\:ss")} elapsed", "stop.png");
this._context.API.ShowMsg($"Stopped {stoppedTimeEntry.description}", $"{elapsed.TotalHours}:{elapsed.ToString(@"mm\:ss")} elapsed", "stop.png");
// Update cached running time entry state
_ = Task.Run(() =>
Expand Down Expand Up @@ -1107,7 +1107,7 @@ internal async ValueTask<List<Result>> RequestStopEntry(CancellationToken token,
results.Add(new Result
{
Title = $"Stop {((string.IsNullOrEmpty(runningTimeEntry.description)) ? "(no description)" : runningTimeEntry.description)} {stopTime.Humanize()}",
SubTitle = $"{projectName} | {newElapsed.Humanize()} ({newElapsed.ToString(@"h\:mm\:ss")})",
SubTitle = $"{projectName} | {newElapsed.Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Hour)} ({newElapsed.TotalHours}:{newElapsed.ToString(@"mm\:ss")})",
IcoPath = (project?.color is not null)
? new ColourIcon(this._context, project.color, "stop.png").GetColourIcon()
: "stop.png",
Expand All @@ -1119,15 +1119,15 @@ internal async ValueTask<List<Result>> RequestStopEntry(CancellationToken token,
{
try
{
this._context.API.LogInfo("TogglTrack", $"{this._selectedProjectId}, {runningTimeEntry.id}, {runningTimeEntry.workspace_id}, {startDate}, {newElapsed.ToString(@"h\:mm\:ss")}, {stopTime}, time span flag", "RequestStopEntry");
this._context.API.LogInfo("TogglTrack", $"{this._selectedProjectId}, {runningTimeEntry.id}, {runningTimeEntry.workspace_id}, {startDate}, {newElapsed.TotalHours}:{newElapsed.ToString(@"mm\:ss")}, {stopTime}, time span flag", "RequestStopEntry");
var stoppedTimeEntry = await this._client.EditTimeEntry(runningTimeEntry, null, null, null, stopTime);
if (stoppedTimeEntry?.id is null)
{
throw new Exception("An API error was encountered.");
}
this._context.API.ShowMsg($"Stopped {stoppedTimeEntry.description}", $"{newElapsed.ToString(@"h\:mm\:ss")} elapsed", "stop.png");
this._context.API.ShowMsg($"Stopped {stoppedTimeEntry.description}", $"{newElapsed.TotalHours}:{newElapsed.ToString(@"mm\:ss")} elapsed", "stop.png");
// Update cached running time entry state
_ = Task.Run(() =>
Expand Down Expand Up @@ -1216,7 +1216,7 @@ internal async ValueTask<List<Result>> RequestDeleteEntry(CancellationToken toke
new Result
{
Title = $"Delete {((string.IsNullOrEmpty(runningTimeEntry.description)) ? "(no description)" : runningTimeEntry.description)}",
SubTitle = $"{projectName} | {elapsed.Humanize()} ({elapsed.ToString(@"h\:mm\:ss")})",
SubTitle = $"{projectName} | {elapsed.Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Hour)} ({elapsed.TotalHours}:{elapsed.ToString(@"mm\:ss")})",
IcoPath = (project?.color is not null)
? new ColourIcon(this._context, project.color, "delete.png").GetColourIcon()
: "delete.png",
Expand All @@ -1227,15 +1227,15 @@ internal async ValueTask<List<Result>> RequestDeleteEntry(CancellationToken toke
{
try
{
this._context.API.LogInfo("TogglTrack", $"{this._selectedProjectId}, {runningTimeEntry.id}, {runningTimeEntry.workspace_id}, {startDate}, {elapsed.ToString(@"h\:mm\:ss")}", "RequestDeleteEntry");
this._context.API.LogInfo("TogglTrack", $"{this._selectedProjectId}, {runningTimeEntry.id}, {runningTimeEntry.workspace_id}, {startDate}, {elapsed.TotalHours}:{elapsed.ToString(@"mm\:ss")}", "RequestDeleteEntry");
var statusCode = await this._client.DeleteTimeEntry(runningTimeEntry.id, runningTimeEntry.workspace_id);
if (statusCode is null)
{
throw new Exception("An API error was encountered.");
}
this._context.API.ShowMsg($"Deleted {runningTimeEntry.description}", $"{elapsed.ToString(@"h\:mm\:ss")} elapsed", "delete.png");
this._context.API.ShowMsg($"Deleted {runningTimeEntry.description}", $"{elapsed.TotalHours}:{elapsed.ToString(@"mm\:ss")} elapsed", "delete.png");
// Update cached running time entry state
_ = Task.Run(() =>
Expand Down Expand Up @@ -1314,7 +1314,7 @@ internal async ValueTask<List<Result>> RequestContinueEntry(CancellationToken to
return new Result
{
Title = (string.IsNullOrEmpty(timeEntry.description)) ? "(no description)" : timeEntry.description,
SubTitle = $"{projectName} | {elapsed.Humanize()} ({DateTime.Parse(timeEntry.start!).Humanize(false)})",
SubTitle = $"{projectName} | {elapsed.Humanize(maxUnit: Humanizer.Localisation.TimeUnit.Hour)} ({DateTime.Parse(timeEntry.start!).Humanize(false)})",
IcoPath = (project?.color is not null)
? new ColourIcon(this._context, project.color, "continue.png").GetColourIcon()
: "continue.png",
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Name": "Toggl Track",
"Description": "A time tracking plugin for Flow Launcher using Toggl Track",
"Author": "JamesNZL",
"Version": "2.1.3",
"Version": "2.1.4",
"Language": "csharp",
"Website": "https://github.com/JamesNZL/flow-toggl-plugin",
"IcoPath": "app.png",
Expand Down

0 comments on commit a99d16e

Please sign in to comment.