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: library item progress #461

Merged
merged 16 commits into from
Sep 13, 2023
Merged

feat: library item progress #461

merged 16 commits into from
Sep 13, 2023

Conversation

tymmesyde
Copy link
Member

@tymmesyde tymmesyde commented Jun 3, 2023

src/types/library/library_item.rs Outdated Show resolved Hide resolved
src/models/ctx/update_library.rs Outdated Show resolved Hide resolved
src/models/ctx/update_library.rs Outdated Show resolved Hide resolved
#[inline]
pub fn progress(&self) -> f64 {
if self.state.time_offset > 0 && self.state.duration > 0 {
self.state.time_offset as f64 / self.state.duration as f64
Copy link
Member

Choose a reason for hiding this comment

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

Depending on what values we expect here, for large-enough values (like u64::MAX) we might get into problems when we use as f64:

https://play.rust-lang.org/?version=stable&mode=release&edition=2021&gist=6e6409d3fd006ac95e1c907299bc826a

Do we have to worry about such large values?
If we do need, then I would suggest using Ratio:

https://docs.rs/num/latest/num/rational/struct.Ratio.html#impl-ToPrimitive
And then try to make a f64 out of it:

https://docs.rs/num/latest/num/trait.ToPrimitive.html#method.to_f64

src/types/library/library_item.rs Show resolved Hide resolved
src/types/library/library_item.rs Outdated Show resolved Hide resolved
@unclekingpin
Copy link
Contributor

@tymmesyde Should we use the new stream bucket now?
cc: @elpiel

@elpiel
Copy link
Member

elpiel commented Jul 17, 2023

@tymmesyde Should we use the new stream bucket now? cc: @elpiel

Yes, we should.

@tymmesyde tymmesyde changed the title feat: library item stream id feat: library item progress Sep 12, 2023
@tymmesyde tymmesyde marked this pull request as draft September 12, 2023 12:10
@tymmesyde tymmesyde marked this pull request as ready for review September 12, 2023 14:06
@elpiel elpiel merged commit 1259c0c into development Sep 13, 2023
1 check passed
@elpiel elpiel deleted the feat/library-item-stream-id branch September 13, 2023 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants