Addressing timesheet_deleteds bug#11
Open
picklecolor2 wants to merge 4 commits intoTSheetsTeam:masterfrom
Open
Addressing timesheet_deleteds bug#11picklecolor2 wants to merge 4 commits intoTSheetsTeam:masterfrom
picklecolor2 wants to merge 4 commits intoTSheetsTeam:masterfrom
Conversation
When using the API to query timesheets_deleted, line 11 causes a problem where the query looks for timesheet_deleteds. This special cases for that class, though I'm a python amateur and there may be a cleaner way to do that.
Looks like some time recently the JSON data returned changed from a string 'true' to the value True. This will allow the wrapper to pull more than the first page of records again.
shree-y
suggested changes
Dec 3, 2020
shree-y
left a comment
There was a problem hiding this comment.
Please add a test in test.py.
I used this to test your changes. Please feel free to make improvements to my test.
# Deleted timesheets
timesheets_deleted = None
timesheets_deleted = api.timesheets_deleted.where(modified_since=datetime(2015,7,1), user_ids=[current_user.id]).all()
if len(timesheets_deleted) > 0:
print (' - Found {0} deleted timesheets'.format(len(timesheets_deleted)))
else:
print(' - No deleted timesheets found')
return
| self.model = repo.model | ||
| self.name = class_to_endpoint(self.model.__name__) + ('' if is_singleton else 's') | ||
| if isinstance(self.repo, repos.TimesheetsDeleted): | ||
| self.name = 'timesheets_deleted' |
There was a problem hiding this comment.
What you have here works, but wondering if it is better to create a method in repository.py to set the name.
We can avoid one-off logic like this, and also if new endpoints are added that follow timesheets_deleted pattern, then we wouldn't need to update the logic here again.
Thoughts?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using the API to query timesheets_deleted, line 11 causes a problem where the query looks for timesheet_deleteds. This special cases for that class, though I'm a python amateur and there may be a cleaner way to do that.