Skip to content

Incrementing or Decrementing existing value for the first time will remove it #843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks done
Nidal-Bakir opened this issue Mar 4, 2023 · 1 comment · Fixed by #860
Closed
4 tasks done
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@Nidal-Bakir
Copy link
Member

New Issue Checklist

Issue Description

using set to set a value and then trying to increment or decrement that value will result in removing the value and the amount parameter from the increment or decrement functions will replace it after this point any call to increment or decrement functions will work fine.

Steps to reproduce

  1. create ParseObject
  2. set a value set("key",2)
  3. increment that value using thesetIncrement("key",5) function
  4. get the value using the value key with get("key")
  5. the result of calling get("key") is 5 which is not expected
  6. noteis that 5 is the amount is passed to setIncrement function

code snippet:

final dietPlansObject = ParseObject("Diet_Plans");

dietPlansObject.set("key", 2);

final anyAmount = 5;
dietPlansObject.setIncrement("key", anyAmount);
// dietPlansObject.setDecrement("key", anyAmount);

final value = dietPlansObject.get("key");

print(value); // 5 but it should be 7

Actual Outcome

Not considering the already existing value in the first call to setIncrement or setDecrement

Expected Outcome

check for already existing value and use it.

Environment

Parse Flutter SDK

  • SDK version: 3.1.15
  • Operating system version: any

Server

  • Parse Server version: any

Logs

@parse-github-assistant
Copy link

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@Nidal-Bakir Nidal-Bakir added the type:bug Impaired feature or lacking behavior that is likely assumed label Mar 4, 2023
@Nidal-Bakir Nidal-Bakir self-assigned this Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
1 participant