Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C covid19india-react
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 27
    • Issues 27
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 11
    • Merge requests 11
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • covid19india
  • covid19india-react
  • Issues
  • #1941
Closed
Open
Issue created May 19, 2020 by Administrator@rootContributor

Wrong delta percentage if previous value is negative

Created by: nayakrahul

Describe the bug Delta percentage is wrong in deltabar graphs if previous value is negative. As you can see in the screenshot, the last 3 delta percentage is wrong.

  1. For May 17, cases decreased from -17 to -26, so percentage delta should be negative but it is shown positive.
  2. For May 18, cases increased from -26 to -18, so percentage delta should be positive but it is shown negative.
  3. For May 19, cases increased from -18 to 7, so percentage delta should be positive but it is shown negative.

This is happening because we are using wrong formula to calculate delta percentage. The current formula does not work if previous value is negative.

Current formula is: (current_value - previous_value)/previous_value --> (incorrect) Correct formula should be: (current_value - previous_value)/abs(previous_value)

We should take absolute value in denominator which will give correct result in all scenarios.

To Reproduce Steps to reproduce the behavior:

  1. Go to state page of Haryana
  2. See the deltabar graph for active cases. I have explained above what is wrong here (if it is seen today).

Expected behavior

Correct delta percentage if negative numbers come into action.

Screenshots Screenshot (72)_LI

Assignee
Assign to
Time tracking