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

Fix DownloadState.get_ratio() #7853

Merged
merged 1 commit into from
Jan 29, 2024
Merged

Fix DownloadState.get_ratio() #7853

merged 1 commit into from
Jan 29, 2024

Conversation

drew2a
Copy link
Contributor

@drew2a drew2a commented Jan 25, 2024

This PR fixes #7817 by changing the function to the following:

    def get_all_time_ratio(self) -> float:
        if not self.lt_status or not self.all_time_download:
            return 0
        return self.all_time_upload / self.all_time_download

@drew2a drew2a changed the title Fix DownloadState,get_ratio() Fix DownloadState.get_ratio() Jan 25, 2024
@drew2a drew2a force-pushed the fix/7817 branch 2 times, most recently from 64e8adb to 8f2a9b9 Compare January 25, 2024 10:52
@drew2a drew2a marked this pull request as ready for review January 25, 2024 11:10
@drew2a drew2a requested review from a team and kozlovsky and removed request for a team January 25, 2024 11:10
Copy link
Contributor

@kozlovsky kozlovsky left a comment

Choose a reason for hiding this comment

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

I added the comment to the original issue #7817. It looks like the previous formula is correct (except when the total_done is zero), and instead of changing the formula, we should display the all_time_upload / all_time_download counters.

@drew2a
Copy link
Contributor Author

drew2a commented Jan 26, 2024

@kozlovsky thank you. I've changed the function to the following:

    def get_all_time_ratio(self) -> float:
        if not self.lt_status or not self.all_time_download:
            return 0
        return self.all_time_upload / self.all_time_download

Also, I've changed the UI, please check the screenshot in the description for this issue.

@drew2a drew2a force-pushed the fix/7817 branch 2 times, most recently from 62febe6 to d3aa116 Compare January 26, 2024 16:04
@drew2a drew2a requested a review from kozlovsky January 26, 2024 16:07
@drew2a drew2a merged commit c1c4907 into Tribler:main Jan 29, 2024
20 checks passed
@drew2a drew2a deleted the fix/7817 branch January 29, 2024 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

per torrent ratio and up/down do not match
2 participants