(New) Star rating (component) implementation | Linked to individual users

I am looking for a way to let users store their individual rating for a specific subject (for example a trip). Everytime they go to the details page of this subject they should be able to see their own rating.

The app is set up in the following way:

Home page > Categories of trips > Trips > Trip Details.

In order to achieve my goal I have almost tried all different variations of creating relationships and the one that is most close to the solution is the following:

I created a relationship between the database of the user and the database of the trips.

Relationship

A “Trip” can have multiple “Users”.

A “User” belongs to one “Trip”.

After that I placed the new star rating feature (of the market place) on the trip details page, with the following settings:

Can users set a rating?

Yes

What property does this set?

Logged In User > Relation variable that connects “User database collection” to “Trip database collection” > Rating

The outcome of this “code” is that I am able to give different trips different ratings, and the app memorizes these, but then again all users automatically have the same ratings for the same trip. I find this very strange since the above mentioned code starts with “Logged In User”.

Can anybody help, please? I really started to like the Adalo builder but now I do not know what to think.

Hi @RisingBuilder ,

Take a look at this.

username password
a@a.com a
b@b.com b
c@c.com c

delete all records in trip ratings collection first.

UI for debugging purpose
UX for shortcut purpose

@Yongki thanks for your reply, but I am not looking for an option where you can see the reviewers under the subject.

You can play with filters.

Hi @RisingBuilder,

The result you get is pretty logical: you have 1 trip for many users’ relation. So when some user changes the rating for that trip, of course it will be updated for everyone - as this is just 1 trip record :slight_smile:

What I would suggest is having a separate “Trip Reviews” collection:

  • relation to Trips m:1. One Trip can have many reviews, but review belongs to a single trip
  • relation to Users m:1. One User can have many reviews, but review belongs to one user
  • rating itself (Numeric).

Then, when user makes a review for the trip, you need to create a record in this collection, and set a rating. I can imagine something like a Trip screen with button “Review”, which (a) creates the new record for current trip+logged-in user, and then leads user to LeaveReview screen, where you put Star Rating component, which changes Current Review’s rating.

Of course you need to protect against multiple reviews for a single trip from the same user. I’d make it using 2 buttons with visibility conditions - one when review doesn’t exist, and it creates review; another is when review exists and it doesn’t create review but just leads the user to review screen. Use Trip->TripReviews->Count + filter for logged-in user to set visibility.

As for me, such logic should work.

Best regards, Victor.

@Victor This makes sense. Thank you for replying.

1 Like