aicore / aicore/libmysql

Math add api adds a `.0` on integer increments

Open
#155 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
2
Forks
1
Avg merge
8m
Merged PRs (30d)
2

Description

When we use math add to increment an integer, a decimal point .0 is added, which is not expected.

Eg. Increment(0) will return 1.0 instead of 1 in db document.

// initial db entry: {  totalDownloads: 273  }
await db.mathAdd(TABLE, documentId, {
        totalDownloads: 1
    });
// initial db entry: {  totalDownloads: 274.0 }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the JavaScript implementation and tests for mathAdd, then trace how an integer increment is represented before it is written to the database. Done means incrementing an integer such as totalDownloads by 1 stores 274 rather than 274.0, while preserving the behavior for other numeric values.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.