Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Guppi.Console/Guppi.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageProjectUrl>https://github.com/rprouse/guppi</PackageProjectUrl>
<RepositoryUrl>https://github.com/rprouse/guppi</RepositoryUrl>
<PackageId>dotnet-guppi</PackageId>
<Version>6.5.2</Version>
<Version>6.5.3</Version>
<PackAsTool>true</PackAsTool>
<ToolCommandName>guppi</ToolCommandName>
<PackageOutputPath>./nupkg</PackageOutputPath>
Expand Down
14 changes: 9 additions & 5 deletions Guppi.Console/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"profiles": {
"Guppi.Console": {
"commandName": "Project",
"commandLineArgs": "weather sunrise"
"profiles": {
"Guppi weather sunrise": {
"commandName": "Project",
"commandLineArgs": "weather sunrise"
},
"Guppi todo sync": {
"commandName": "Project",
"commandLineArgs": "todo sync"
}
}
}
}
9 changes: 9 additions & 0 deletions Guppi.Core/Services/TodoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ public async Task Sync()
googleTasks.Remove(gTask);
}

// Tasks in the local list with an ID that are not in Google need to be marked as done in the local list
var doneOnGoogleIds = todo.Where(t => t.SpecialTags.ContainsKey(IdTag) && !googleTasks.Any(g => t.SpecialTags[IdTag] == g.Id))
.Select(t => t.LineNumber)
.ToArray();

var doneCommand = new DoTasksCommand { ItemNumbers = doneOnGoogleIds };
await Mediator.Send(doneCommand);
AnsiConsole.WriteLine($"{doneOnGoogleIds.Length} tasks marked as done in todo.txt");

// Tasks in Google that are not in the local list need to be added to the local list
var notLocal = googleTasks
.Where(t => string.IsNullOrEmpty(t.Completed))
Expand Down
Loading