-
Notifications
You must be signed in to change notification settings - Fork 9
Fix multiple daily scrums issue #12
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
base: master
Are you sure you want to change the base?
Conversation
looks good, approving. |
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.
I don't remember that much about this codebase, but leaving a quick review in case its helpful.
Glad this code is still in use!
@@ -174,7 +174,16 @@ def get_upcoming_workdays(workdays_ahead: int = 2) -> typing.Iterator[datetime.d | |||
# to help ensure the most recent existing e-scrum issue is included even when other | |||
# non e-scrum issues exist | |||
issues = repo.get_issues(state='all', sort='number', direction='desc') | |||
issues = issues[:min(10 + args.workdays_ahead, issues.totalCount)] | |||
# If totalCount is working properly |
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.
consider adding a link to the PR with the bug description or describing it in the comment
# But if that's not possible, just continue | ||
except: | ||
pass |
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.
Do you know more about the error that could occur (i.e. except a specific error) and why it happens?
There is a known issue that totalCount returns 0 when the result is unknown: PyGithub issue. So, there are some known issues with totalCount and we're just trying to patch up the buggy behavior. I will let this PR sit until we know whether Casey's PR #13 resolves the problem. |
Problem
For the past ~20 days scrum-lord has been opening multiple issues for each day.
Often 2 issues are opened, but sometimes more than that.
After investigation it seems that
issues.totalCount
seems to be the problem.Instead of returning an accurate count of number of total github issues, it often returns 0.
So, scrum-lord thinks that there are no existing daily issues and it creates (another) one.
Solution
I fixed it in a not-so-pretty-but-effective-way, so that scrum-lord checks first whether
totalCount
is greater than 0 (which means it's probably working correctly) and if that's not the case we try to go on anyway.It's tricky to test for this kind of problem, because it requires connecting to an actual repo and right now the tests are only set up to test some functions locally. So, none of the tests were failing even when something was broken. It also means you just gotta trust me that this fixes it. 😂