Skip to content

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

@Nidal-Bakir

Description

@Nidal-Bakir

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions