You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During my local testing I ran into a strange issue using the Fiori Elements front-end.
I've added a virtual spotsAvalaible property to my entity Courses. This virtual property I'm going to fill in the after hook of the READ of the Courses:
srv.after('READ','Courses',(courses,req)=>{// problem from fiori: couses has counted object --> $countreturncourses.map(asynccourse=>{// Get the reservations for this courseconstreservations=awaitcds.transaction(req).run(SELECT.from(Reservations).where({course_ID: course.ID}))// Caluclate spots takenconstspotsTaken=reservations.reduce((total,reservation)=>total+reservation.quantity,0)course.spotsAvailable=course.spots-spotsTaken})})
But when using the Fiori elements front-end the hook crashes with following error. For the following request in the $batch:
GET Courses?$count=true&$select=ID,days,spots,title,trainer_ID&$expand=trainer($select=ID,name)&$skip=0&$top=30 HTTP/1.1
Hello CAP Enthusiasts,
During my local testing I ran into a strange issue using the Fiori Elements front-end.
I've added a virtual spotsAvalaible property to my entity Courses. This virtual property I'm going to fill in the after hook of the READ of the Courses:
This works when I use postman and do a get on the courses. (http://localhost:4004/training/Courses)
But when using the Fiori elements front-end the hook crashes with following error. For the following request in the $batch:
GET Courses?$count=true&$select=ID,days,spots,title,trainer_ID&$expand=trainer($select=ID,name)&$skip=0&$top=30 HTTP/1.1
`
POST /training/$batch
When debugging i notice that the after-hook gets called a second time, but this time the courses-parameter is filled with a counted object:
[{counted: 1}]
Is there a way to solve this?
Thanks!
Kind regards,
Robin
The text was updated successfully, but these errors were encountered: