skolplattformen icon indicating copy to clipboard operation
skolplattformen copied to clipboard

Hjärntorget - Some messages shows on all children

Open archevel opened this issue 3 years ago • 0 comments

Currently some messages are being shown for all children even though the content of the message makes it clear that it belongs only to children at a particular school.

Currently we divide messages a partent receives (fetched via a call to https://hjarntorget.goteborg.se/api/wall/events?language=en&limit=500) between their children by checking if the creator/sender have a common event with any child. This is done by calling https://hjarntorget.goteborg.se/api/event-members/members-having-role?eventId=${eventId}&roleId=${roleId}) for each event returned by https://hjarntorget.goteborg.se/api/events/events-sorted-by-name?offset=0&limit=100 and checking each role for that event.

That means we have a list of all common participants (students and teachers and possibly others depending on the roles associated with the event). So if the sender and child are both participants in some event together we will show the message as a Notification for that child.

However, some events do not include any students (for instance: 138JÄTS 21/22 VH F-9 with id 175700) and this event is used at some of my childrens' school to send messages to the guardians of students. At the moment these messages, that we can not connect to a particular set of children, is shown under the "News". Unfortunately this means they also show up for children attending another school or daycare.

Is there a way of connecting these messages so they only need to be shown as news/notifications for some children? One approach, albeit prehaps a bit unreliable, would be to use the name of the events: 138JÄTS 21/22 VH F-9 and 138JÄTS 21/22 7B have a common prefix: 138JÄTS 21/22 . So this could be used to check for connectedness between children and senders even when they don't belong to a common group. Is there a better approach?

archevel avatar Dec 14 '21 13:12 archevel