-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Todo sync now handles priorty correctly #203
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -95,7 +95,16 @@ public async Task Sync() | |||||
.ToList(); | ||||||
foreach (var task in notLocal) | ||||||
{ | ||||||
string taskStr = $"{task.Updated.GetRfc3339Date().ToString("yyyy-MM-dd")} {task.Title}"; | ||||||
// Pull the priority out of the title | ||||||
string priority = string.Empty; | ||||||
string title = task.Title; | ||||||
if (title.Length >= 3 && title[0] == '(' && title[2] == ')' && title[3] == ' ') | ||||||
{ | ||||||
priority = title.Substring(0, 4); | ||||||
title = title.Substring(3).Trim(); | ||||||
} | ||||||
|
||||||
string taskStr = $"{priority}{task.Updated.GetRfc3339Date().ToString("yyyy-MM-dd")} {title}"; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Improve task string formatting. While the priority is now correctly placed before the date, the string construction could be improved. Consider this more readable format using string interpolation: -string taskStr = $"{priority}{task.Updated.GetRfc3339Date().ToString("yyyy-MM-dd")} {title}";
+string taskStr = $"{priority} {task.Updated.GetRfc3339Date():yyyy-MM-dd} {title}"; This change:
📝 Committable suggestion
Suggested change
Comment on lines
+98
to
+107
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Priority sync implementation is incomplete for local to Google direction The code review reveals an asymmetric implementation of priority handling:
This means priorities set in local todo.txt files will be lost when syncing to Google Tasks. 🔗 Analysis chainVerify priority sync behavior in both directions. The implementation looks good for handling priorities from Google Tasks to local todo.txt. However, we should verify the behavior in both directions. Let's check for any existing priority-related tests: Would you like me to help create test cases to verify:
I'll search for priority handling and test implementations to verify the sync behavior in both directions. The previous search might have been too specific, so let's broaden it. I need to verify how the task titles are handled in both sync directions to understand the complete priority sync implementation. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for priority-related test cases
rg -l "priority.*test" --type cs
# Check for existing todo.txt test files
fd -e txt "todo.*test"
Length of output: 59 Script: #!/bin/bash
# Let's try a broader search for priority-related code and tests
rg -i "priority" --type cs -A 3 -B 3
# Also search for task-related test files
fd -e cs "test"
# Look for any existing test classes
ast-grep --pattern 'class $_ { $$$ [TestMethod] $$$ }'
Length of output: 2226 Script: #!/bin/bash
# Let's look for the complete TodoService implementation to understand the bidirectional sync
ast-grep --pattern 'class TodoService { $$$ }'
# Search for todo.txt related code
rg "todo.txt" --type cs -A 3 -B 3
# Look for task title handling in both directions
rg "Title" --type cs -A 3 -B 3 Guppi.Core/Services/TodoService.cs
Length of output: 3319 |
||||||
if (!string.IsNullOrEmpty(task.Due)) | ||||||
{ | ||||||
taskStr += $" due:{task.Due}"; | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enhance priority validation and extraction.
The priority extraction logic could be improved to handle edge cases and validate the priority format more strictly.
Consider applying these improvements:
This change:
📝 Committable suggestion