Skip to content
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

feat: Added time until next match, when there are no live matches. #99

Merged
merged 6 commits into from
Feb 10, 2023

Conversation

wiflow
Copy link
Contributor

@wiflow wiflow commented Feb 8, 2023

Example:
image

@alepouna alepouna added the enhancement New feature or request label Feb 8, 2023
src/Browser.py Outdated
days, remainder = divmod(total_seconds, 86400)
hours, remainder = divmod(remainder, 3600)
minutes, seconds = divmod(remainder, 60)
return f'{days}d {hours}h {minutes}m'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, change this to something like f'None - next in {days}d {hours}h {minutes}m'.
Another light improvement could be excluding the days if it is 0 - f'None - next in {str(days) + "d" if days else ""} {hours}h {minutes}m'.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise we get a lot of questions from users who are used to the old text

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe its an idea to place this outside the table, since this has no relation with Live matches

Maybe using rich.layout? https://rich.readthedocs.io/en/stable/layout.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the new PR it says "None - Next one in x hours and x minutes.

I think placing it outside, would just look off, and will add a bit of clutter.
If Poro thinks your suggestion is better i can change it, but tbh, i think this looks very good.

…isplay hours and minutes. Also added "None - " in front of time until next match, as requested.
src/Browser.py Outdated
minutes, seconds = divmod(remainder, 60)
return f"None - next in {str(days)}d" if days else f'None - next in {hours}h {minutes}m'
except:
return ""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change it to "None" to keep it consistent.

@LeagueOfPoro
Copy link
Owner

Other than the two minor things, it's ready to merge :) Nice PR

@wiflow
Copy link
Contributor Author

wiflow commented Feb 10, 2023

Unsure if this was the correct way, will it ever reach if res.status_code? :I

liveMatchesMsg = f"{', '.join(liveMatchesStatus)}"
newDrops = self.browser.checkNewDrops(self.stats.getLastDropCheck(self.account))
self.stats.updateLastDropCheck(self.account, int(datetime.now().timestamp()*1e3))
else:
liveMatchesMsg = "None"
liveMatchesMsg = self.browser.getTimeUntilNextMatch()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would ideally like to see the addition of a timeout between each check of getTimeUntilNextMatch but it is not necessary. It would mostly be for efficiency purposes, so you aren't making multiple unnecessary requests per thread.

Copy link
Owner

@LeagueOfPoro LeagueOfPoro Feb 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should actually refactor the whole program and create a new thread that would handle common tasks. Like get live, schedule etc.

Those actions do not require auth.

@LeagueOfPoro
Copy link
Owner

Unsure if this was the correct way, will it ever reach if res.status_code? :I

I fixed it. It wouldn't reach the status code check.

@LeagueOfPoro LeagueOfPoro merged commit 0719b37 into LeagueOfPoro:master Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants