DEV Community

Seif Ahmed
Seif Ahmed

Posted on Edited on AI-assisted

Why I Ditched Precise Math to Keep My Users Happy

When building the new analytics page for Vlox, I faced a choice: Use precise math or modify data to make users feel good.

I chose the second option.

The Problem

If a user gets their first like and your target is 100, a standard formula fills the progress bar by 1%.

To a human, 1% looks empty. It's like saying: "Your content is bad." Discouraged users close the app and never return.

The Solution

Instead of using exact math, I used a system with a good baseline. The percentage of likes count greater than 0 jumps between 20, 40, 60, 80 and 100. The percentage is calculated via this formula:

likes === 0 ? 0 : Math.min(100, Math.max(20, Math.floor(likes / 20) * 20));
Enter fullscreen mode Exit fullscreen mode

Liked the project? Give it a star Vlox on GitHub ⭐!

Top comments (0)