Skip to content

Commit

Permalink
Add number of registrations on waiting list #41
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorwolf committed Sep 1, 2017
1 parent 1eb70c8 commit c81296f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions odataparticipant/procedures/RegistrationNumbersRead.hdbview
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,22 @@ schema = "SITREG";
query = "SELECT
\"Event\".\"ID\" AS \"EventID\",
CAST( \"Event\".\"MaxParticipants\" - IFNULL (\"Participant\".\"Yes\", 0) AS Integer ) AS \"Free\",
CAST( IFNULL (\"Participant\".\"Yes\", 0) AS Integer ) AS \"Participants\"
CAST( IFNULL (\"Participant\".\"Yes\", 0) AS Integer ) AS \"Participants\",
CAST( IFNULL (\"Waitinglist\".\"Waiting\", 0) AS Integer ) AS \"Waiting\"
FROM \"SITREG\".\"com.sap.sapmentors.sitreg.data::SITreg.Event\" AS \"Event\"
LEFT OUTER JOIN (
SELECT \"EventID\", COUNT(*) AS \"Yes\"
FROM \"SITREG\".\"com.sap.sapmentors.sitreg.data::SITreg.Participant\"
WHERE \"RSVP\" = 'Y'
GROUP BY \"EventID\" ) AS \"Participant\"
ON \"Event\".\"ID\" = \"Participant\".\"EventID\"
GROUP BY \"Participant\".\"Yes\", \"Event\".\"MaxParticipants\", \"Event\".\"ID\";";
LEFT OUTER JOIN (
SELECT \"EventID\", COUNT(*) AS \"Waiting\"
FROM \"SITREG\".\"com.sap.sapmentors.sitreg.data::SITreg.Participant\"
WHERE \"RSVP\" = 'W'
GROUP BY \"EventID\" ) AS \"Waitinglist\"
ON \"Event\".\"ID\" = \"Waitinglist\".\"EventID\"
GROUP BY \"Waitinglist\".\"Waiting\", \"Participant\".\"Yes\", \"Event\".\"MaxParticipants\", \"Event\".\"ID\";";
// Using an hdbtablefunction does not work as it would need SELECT authorization on the Participant table
// query = "select * from \"com.sap.sapmentors.sitreg.odataparticipant.procedures::RegistrationNumbersReadFunc\"()";
// depends_on_view=["com.sap.sapmentors.sitreg.odataparticipant.procedures::RegistrationNumbersReadFunc"];

0 comments on commit c81296f

Please sign in to comment.