Skip to content
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

Join or and pure query #951

Open
4 tasks done
catalunha opened this issue Jul 6, 2023 · 4 comments
Open
4 tasks done

Join or and pure query #951

catalunha opened this issue Jul 6, 2023 · 4 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@catalunha
Copy link

New Issue Checklist

Issue Description

Hello Masters,

I'm trying to solve a query and I'm not succeeding. And I've done a lot of testing. I hope to get your precious time and experience to see if this has a solution.
The following snippet gives me a list of all calls made by user hE0Ng2FSwQ:

   final QueryBuilder<ParseObject> queryAttendance =
       QueryBuilder<ParseObject>(ParseObject(AttendanceEntity.className));
   queryAttendance.whereEqualTo(
       AttendanceEntity.professional,
       (ParseObject(UserProfileEntity.className)..objectId = 'hE0Ng2FSwQ')
           .toPointer());

   final list = await AttendanceB4a().list(
     queryAttendance,
     cols: {
       "${AttendanceEntity.className}.cols": [AttendanceEntity.id]
     },
   );

The following snippet gives me all the events that belong to that user's previous calls.

   List<QueryBuilder<ParseObject>> listQueries = [];
   for (var element in list) {
     final QueryBuilder<ParseObject> queryTemp =
         QueryBuilder<ParseObject>(ParseObject(EventEntity.className));
       queryTemp.whereEqualTo(
         EventEntity.attendances,
         (ParseObject(AttendanceEntity.className)..objectId = element.id)
             .toPointer());
     listQueries.add(queryTemp);
   }
   QueryBuilder<ParseObject> eventsByUser = QueryBuilder.or(
     ParseObject(EventEntity.className),
     listQueries,
   );

Until then, everything is fine.
Of these events I only want the ones that are on the date of the following excerpt

   final QueryBuilder<ParseObject> queryByDate =
       QueryBuilder<ParseObject>(ParseObject(EventEntity.className));
   final start = DateTime(2023, 06, 25);
   final end = DateTime(2023, 06, 27);

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

I think the following snippet would give me the and between them. That is, events by date and by user.

   QueryBuilder<ParseObject> mainQuery2 =
       QueryBuilder.and(ParseObject(EventEntity.className), [queryByDate, eventsByUser]);

But it doesn't return anything.

The queryByDate query returns the events:
ZVf7WTd6cM
qAvT71CMAL

The query eventsByUser returns the events:
HMsggKqGmz
P5F1D6dsJz
ZVf7WTd6cM
rFHpMtVkaE

See that what I want is precisely the ZVf7WTd6cM event that belongs to the customer service on the specified date.

Steps to reproduce

any pure query and QueryBuilder.and and QueryBuilder.or

Actual Outcome

Expected Outcome

Environment

Parse Flutter SDK

  • SDK version: 5.1.0
  • Flutter version: 3.10.5
  • Dart version: 3.0.5
  • Operating system version: POP

Server

  • Parse Server version: 4.10.4

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.

@mtrezza
Copy link
Member

mtrezza commented Jul 6, 2023

@catalunha Is this a suspected SDK issue or are you asking for code support?

@mtrezza mtrezza added the type:question Support or code-level question label Jul 6, 2023
@catalunha
Copy link
Author

Sorry. What would it be: Is this a suspected SDK issue

@catalunha
Copy link
Author

I already changed the Parse Version in B4A. I already changed the parse_server_sdk in the pubspec and nothing works for this query.

@mtrezza mtrezza added type:bug Impaired feature or lacking behavior that is likely assumed and removed type:question Support or code-level question labels Jul 6, 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
Development

No branches or pull requests

2 participants