Skip to content

Commit

Permalink
negative votes bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrandaccio committed Jun 25, 2021
1 parent aa7fdf6 commit b41722c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pages/vote.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ function Vote({ query }) {
* @param {boolean} increment -/+ button toggle
*/
const calculateShow = (current, increment) => {
const change = increment ? 1 : -1;
const canOccur =
Math.abs(Math.pow(current, 2) - Math.pow(current + 1, 2)) <= credits;
Math.abs(Math.pow(current, 2) - Math.pow(current + change, 2)) <= credits;
// Check for absolute squared value of current - absolute squared valueof current + 1 <= credits

// If current votes === 0, and available credits === 0
Expand Down

0 comments on commit b41722c

Please sign in to comment.