I am currently working with Firebase and Android. I am trying to make a rating system for a list of restaurants but I have found a detail, I do not know how I can get the grandchildren from a list of children of a parent node and then take the average of each restaurant.
The parent node refers to the container of the ids of each Restaurant, inside I have a list of the qualifications of the users of that Restaurant and I am trying to obtain all the qualified restaurants with their qualifications and to attach the results in a RecyclerView but I do not know how to do it correctly.
SOLUTION
I do not know if it is the most efficient solution but I managed to make it work, what I did was create two variebles List < > and a HashMap < >.
The first List < > to store the basic information of the Restaurant (Id, Name, Specialty, etc ...), the HashMap < > to store the ( id ) of each Restaurant as the key and the ( rating ) as the value and the last variable List ; to gather all the information in a single list and then pass it to the RecyclerView. (For this, also create 3 POJO classes)
calculate the average
Function to gather all the information
The node in the database in Firebase changes it and it looks like this: