parse-community / Parse-SDK-Flutter

The Dart/Flutter SDK for Parse Platform
https://parseplatform.org
Apache License 2.0
575 stars 190 forks source link

'pure query' and 'QueryBuilder.and' different results #950

Open catalunha opened 1 year ago

catalunha commented 1 year ago

New Issue Checklist

Issue Description

See the simple query for a range of dates. Or I believe any other query.

  final QueryBuilder<ParseObject> query =
      QueryBuilder<ParseObject>(ParseObject('TableOrClass'));
  final start = DateTime(2023, 06, 25);
  final end = DateTime(2023, 06, 27);

  query.whereGreaterThanOrEqualsTo(
      EventEntity.day, DateTime(start.year, start.month, start.day));
  query.whereLessThanOrEqualTo(
      EventEntity.day, DateTime(end.year, end.month, end.day, 23, 59));
query.query();

The result is as expected. The filter. Result: Correct filter

Now the same query but passing through QueryBuilder.and but with the same simple query as before.

  final QueryBuilder<ParseObject> query =
      QueryBuilder<ParseObject>(ParseObject('TableOrClass'));
  final start = DateTime(2023, 06, 25);
  final end = DateTime(2023, 06, 27);

  query.whereGreaterThanOrEqualsTo(
      EventEntity.day, DateTime(start.year, start.month, start.day));
  query.whereLessThanOrEqualTo(
      EventEntity.day, DateTime(end.year, end.month, end.day, 23, 59));

  QueryBuilder<ParseObject> queryAnd =
      QueryBuilder.and(ParseObject(EventEntity.className), [query]);

queryAnd.query();

The result should be the correct filter. But it returns all the data. In other words, it ignores the filter. But the and is pure. Shouldn't it be the same as the previous one? Result: all data

Steps to reproduce

any pure query and QueryBuilder.and

Actual Outcome

different results

Expected Outcome

different equals

Environment

Parse Flutter SDK

Server

Logs

parse-github-assistant[bot] commented 1 year ago

Thanks for opening this issue!