Git Product home page Git Product logo

Comments (15)

TaylanTatli avatar TaylanTatli commented on September 26, 2024

It's a liquid problem. See how it works here: https://help.shopify.com/themes/liquid/filters/math-filters#floor
I don't want to mess with javascript just for this.

from moon.

awnumar avatar awnumar commented on September 26, 2024

There's also https://help.shopify.com/themes/liquid/filters/math-filters#ceil

from moon.

TaylanTatli avatar TaylanTatli commented on September 26, 2024

Didn't look that. Did you try? Is it working?

from moon.

awnumar avatar awnumar commented on September 26, 2024

I'm not actually that familiar with the layout of the theme and how it all interacts, so no, I haven't tested it myself. But, it looks like it's just a standard ceiling function. If you want me to test it I can do, you'll just have to point me in the right direction. :P

from moon.

awnumar avatar awnumar commented on September 26, 2024

Is there support for conditions? If so, floor could be used when the value is less than half way above the mark, and ceiling could be used when it's more. This would be more accurate than simply flooring or ceiling the value all the time.

from moon.

TaylanTatli avatar TaylanTatli commented on September 26, 2024

in _includes/read-time.html,
changing
assign readtime = content | strip_html | number_of_words | divided_by:site.words_per_minute
to
assign readtime = content | strip_html | number_of_words | divided_by:site.words_per_minute | ceil
should work. I don't know right now.
I have an exam tomorrow, so I can't work on it today.

from moon.

awnumar avatar awnumar commented on September 26, 2024

That probably will not work, since divided_by apparently floors the value already. I'll test later.

from moon.

TaylanTatli avatar TaylanTatli commented on September 26, 2024

Ok, thank you. Let me know.

from moon.

TaylanTatli avatar TaylanTatli commented on September 26, 2024

@libeclipse this should fix this problem. It's working locally.

from moon.

TaylanTatli avatar TaylanTatli commented on September 26, 2024

for the reference: https://shopify.github.io/liquid/filters/divided_by/#controlling-rounding

from moon.

awnumar avatar awnumar commented on September 26, 2024

What's the expected behaviour now?

from moon.

TaylanTatli avatar TaylanTatli commented on September 26, 2024

With your example: 750 words / 200 word per minute = 3.75 minute and with rounding it's 4 minute. It was 3 minute before. This is what you want, isn't it? Am I misunderstood?

from moon.

awnumar avatar awnumar commented on September 26, 2024

So it rounds to the nearest minute now instead of flooring? If so, yeah
that's solved it.
On 16 Jun 2016 14:41, "Taylan Tatlı" [email protected] wrote:

With your example: 750 words / 200 word per minute = 3.75 minute and with
rounding it's 4 minute. It was 3 minute before. This is what you want,
isn't it? Am I misunderstood?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#29 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AIhzn0CeK7yXV8vGarFp2MiCuRknsBgTks5qMVJtgaJpZM4IvcEo
.

from moon.

TaylanTatli avatar TaylanTatli commented on September 26, 2024

Yep. It rounds to the nearest minute now.

from moon.

awnumar avatar awnumar commented on September 26, 2024

Sorted fam.
On 16 Jun 2016 14:51, "Taylan Tatlı" [email protected] wrote:

Yep. It rounds to the nearest minute now.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#29 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AIhzn6NhrofLah3hIV-7RN8fdYMqsoHWks5qMVTRgaJpZM4IvcEo
.

from moon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.