-
-
Notifications
You must be signed in to change notification settings - Fork 97
Handle null cases for Events.DIRTY
#1663
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
Conversation
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.
Neat. I think that should do it 👍 Since the queries are longer now I'd prefer to have them indented, but not sure if @rfc2822 agrees, so feel free to leave it like that.
app/src/androidTest/kotlin/at/bitfire/davdroid/resource/LocalCalendarTest.kt
Outdated
Show resolved
Hide resolved
app/src/main/kotlin/at/bitfire/davdroid/resource/LocalCalendar.kt
Outdated
Show resolved
Hide resolved
app/src/main/kotlin/at/bitfire/davdroid/resource/LocalCalendar.kt
Outdated
Show resolved
Hide resolved
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.
Looks good!
I like that the expression is always in parentheses. We should also write all SQL keywords like IS NULL
in upper-case. If there's mixed case, it could cause the impression that is NULL
and IS NULL
is something different.
Did you check whether Events.DIRTY
is used somewhere else where this problem may occur, including in the synctools library?
Thanks for indenting 👍
Took a quick look. We could mention it here:
I don't think there are other places, but better check yourself too. Synctools looks okay. |
Improved kdoc and used capital letters |
Ah dammit. I just realise |
Yeah... the kdoc currently for However, for example, |
The issue is that there's |
Exactly. I would provide a generic plain text description in the interface and override the generic kdoc by adding kdoc to the implementations. There we can mention |
If it's only about the KDoc: or just "the dirty flag of the respective provider"? |
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.
Minor comments about tests
app/src/androidTest/kotlin/at/bitfire/davdroid/resource/LocalCalendarTest.kt
Outdated
Show resolved
Hide resolved
app/src/androidTest/kotlin/at/bitfire/davdroid/resource/LocalCalendarTest.kt
Outdated
Show resolved
Hide resolved
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.
Pull Request Overview
This PR fixes the handling of null values for the Events.DIRTY
field by updating SQL WHERE clauses to properly check for both null and 0 values when identifying "not dirty" events.
- Updated SQL conditions from
NOT dirty
to(dirty IS NULL OR dirty=0)
in bothmarkNotDirty
andremoveNotDirtyMarked
methods - Added comprehensive test coverage for both dirty=0 and dirty=null scenarios
- Updated documentation to reflect the more accurate behavior description
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
LocalCollection.kt | Updated interface documentation to remove specific implementation details about dirty field handling |
LocalCalendar.kt | Fixed SQL WHERE clauses to properly handle null dirty values in addition to 0 values |
LocalCalendarTest.kt | Added comprehensive test cases to verify correct handling of both dirty=0 and dirty=null scenarios |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Looks good for me
(So ready to merge @ArnyminerZ :)) |
Purpose
See #1659.
Events.DIRTY
can be null, but we are not correctly handling it withNOT dirty
.Short description
NOT dirty
TO(dirty is NULL OR dirty=0)
Checklist