ctsit / redcapcustodian

Simplified, automated data management on REDCap systems
Other
12 stars 6 forks source link

Address fatal bug in sync_table #97

Closed ChemiKyle closed 1 year ago

ChemiKyle commented 1 year ago

caused when delete = T but there are no records to delete

ChemiKyle commented 1 year ago

Testing this bug can be accomplished by setting delete = T to any call of sync_table where data_diff_output$delete_records is NA.

pbchase commented 1 year ago

Testing this bug can be accomplished by setting delete = T to any call of sync_table where data_diff_output$delete_records is NA.

I added a two tests using mtcars data wherein I chewed on the data with dplyr, then "fixed" it with sync_table. They showed a flaw in your commit. I fixed that and now both tests pass. I also removed an older, less complete test of sync_table.

I then mirrored the new testing strategy to sync_table_2 to see if it was subject to the same bug you found. It was not.

Please check my work and merge if the tests pass for you and you like what I did.