-
-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Increment field Example #92
Comments
Hey
I think increment should increment it server side, not locally. Possibly
remove the .save line. Call increment and check the server. You could be
overwritting the incremented value... Although I could be wrong?
…On Mon, Mar 4, 2019, 21:13 aminediab ***@***.***> wrote:
hi all!
I am trying to test the increment the Carbs field using the following code
but have no luck, could anyone please indicate what I am doing wrong!
Thanks,
var apiResponse = await DietPlan()
.getObject('i1FgSlj5TJ');
if (apiResponse.success && apiResponse.result != null) {
var dietPlan = apiResponse.result as DietPlan;
dietPlan.increment('Carbs', 10);
dietPlan.save();
}
------------------------------
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#92>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHgn3rO3koxon4bmiqbDPAvC_ihhdA-2ks5vTYyRgaJpZM4bdOB2>
.
|
Hi Phill, |
It should just work server side when you increment. The increment method returns a Result object. Can you verify the result that is returned after calling increment? I.e. 'var response = dietPlan.increment('Carbs', 10);' |
OK the response is => (Instance of 'Future') with no returned object! |
Just to check, I must have missed out the await as it's an instance of a
Future.
My bad!
|
Phill I don't see that you missed the await! /// Increases a num of an object by x amount |
Apologies, I meant my code example to you. I missed the await. 'var response = await dietPlan.increment('Carbs', 10);' |
OK, now the response result is null, and i have a parse error: Unexpected End of Json Input |
Ah okay so it looks to be an error with the SDK. I'll look into that
tomorrow for you!
…On Mon, Mar 4, 2019, 21:54 aminediab ***@***.***> wrote:
OK, now the response result is null, and i have a parse error: Unexpected
End of Json Input
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#92 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHgn3uBl0Y-e_E0C-UJJiJbvfMkD9tdrks5vTZYHgaJpZM4bdOB2>
.
|
Great, I have another question when deleting and object the two parameters are path and objectId. The path is the local storage path, when pinning an object, lets say i want to pin a diet plan object, what path do i use for deleting it in both online and local? |
I did not realize it was that late in the evening! good night we'll pick it up tomorrow, thanks a lot |
Hey, yeah that is an issue. I noticed it the other day. It's been changed
by a contributor that was looking to delete ParseFiles. That will be fixed
shortly.
…On Mon, Mar 4, 2019, 22:00 aminediab ***@***.***> wrote:
Great, I have another question when deleting and object the two parameters
are path and objectId. The path is the local storage path, when pinning an
object, lets say i want to pin a diet plan object, what path do i use for
deleting it in both online and local?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#92 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHgn3n5IYXlEHQe-LPkqSWCejvdN8tVXks5vTZeSgaJpZM4bdOB2>
.
|
Good Morning Phill, void deleteDietPlanObject() async { // test if pin exists |
That will be removed shortly. It should be an optional for path, not a
requirement.
I'll amend that in the next release.
…On Tue, Mar 5, 2019, 10:01 aminediab ***@***.***> wrote:
Good Morning Phill,
Thank you for taking the time to fix the errors. I have another question,
after successfully pinning a diet_plan object I tried to delete it online
and locally, however I don't know what is the path that i should use, in
this case used null! I can delete online but not locally, to test I used
the following code as example, what is the path syntax?
void deleteDietPlanObject() async {
var apiResponse = await DietPlan().delete(null, 'i1FgSlj5TJ');
if (apiResponse.success && apiResponse.result != null) {
print(ApplicationConstants.keyAppName +
": " +
apiResponse.result.toString());
}
// test if pin exists
DietPlan newDietPlanFromPin = await DietPlan().fromPin('i1FgSlj5TJ');
if (newDietPlanFromPin != null) {
print(newDietPlanFromPin.get('Carbs'));
print('Retreiving from pin worked!');
} else {
print('Error');
}
}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#92 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHgn3hI-oDNEEaXEtc9U62FGM1C394Lzks5vTkB0gaJpZM4bdOB2>
.
|
@phillwiggins and @aminediab. I found the reason for the error in increment and decrement. I'm completing the tests and I'm going to upload a PR. The same solution will solve problems in addAll, addUnique and add in List. I'll also add support for Pointer. Same as increment and decrement and list operations, saving a Pointer must be done in two steps at creation. First you must save the object and then use the result of the Response (as ParseObject) and perform the operations. During creation ParseObject does not have the objectId, only the response it has. Then the response is used to perform the operations. Sorry, I'm not fluent in English I'm using a translator for support. |
Great work Rodrigo!
I've not had a chance to use this feature in my own apps yet so I didn't
realise they weren't working correctly. I'll review the code as soon as you
create a PR. Again, thank you!
…On Thu, Mar 7, 2019, 20:01 Rodrigo de Souza Marques < ***@***.***> wrote:
@phillwiggins <https://github.com/phillwiggins> and @aminediab
<https://github.com/aminediab>.
I found the reason for the error in increment and decrement. I'm
completing the tests and I'm going to upload a PR.
The same solution will solve problems in addAll, addUnique and add in List.
I'll also add support for Pointer.
Same as increment and decrement and list operations, saving a Pointer must
be done in two steps at creation.
First you must save the object and then use the result of the Response (as
ParseObject) and perform the operations.
During creation ParseObject does not have the objectId, only the response
it has. Then the response is used to perform the operations.
Sorry, I'm not fluent in English I'm using a translator for support.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#92 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHgn3uc4TFoybEVUpYILMxM9Jgdlg-E9ks5vUW_9gaJpZM4bdOB2>
.
|
Thanks Rodrigo! |
Phill/Rodrigo, You all are doing a Great Job. I really believe, once most of the parse server functionality is implemented and tested, this Flutter Parse Server Package will surely be in the Top 10! As a reminder, The increment and decrement still not working as of your latest git. Rodrigo mentioned he is going to fix it! |
Hi @aminediab, |
Hi @aminediab. Update pubspec.yaml dependencies: |
Hi Rodrigo, void incrementDietPlanProtein() async {
} |
Hi @aminediab You can verify that the file code "lib/src/objects/parse_object.dart" in your local repository contains these changes here: https://github.com/phillwiggins/flutter_parse_sdk/pull/107/files You can check this using Go To -> Declaration in Android Studio or Go To Definition in Visual Code You can verify that the change is the same for array operations. Function _sortArrays: If you wait a while, I've created the setIncrement and setDecrement methods to be used in conjunction with save (), same as library for Android / iOS. For example: parseObject.setIncrement ("intNumber2", 2); parseObject.setDecrement ("intNumber3", 2); apiResponse = await parseObject.save (); |
Hi @aminediab Did you take the test again? The new features are available in the latest release. |
@phillwiggins Resolved in the last release. Updated documentation. |
@phillwiggins |
hi all!
I am trying to test the increment option using the following code but have no luck, could anyone please indicate what I am doing wrong!
Thanks,
var apiResponse = await DietPlan()
.getObject('i1FgSlj5TJ');
The text was updated successfully, but these errors were encountered: