- tags
- #events
events-onsite¶✎ edit
Check-in. A check-in at the door marks the registration as attended; a check-in into a session counts towards its room, and when a session has more people than its room holds, the organizers are told.
$when events.checkedIn (id: String) {
c = dom.find(cls = "CheckIn", key = id)
r = dom.find(cls = "Registration", key = c.registration)
dom.upsert(cls = "Registration", entity = r + {status: "attended"})
payload = if (c.session is defined) then events.roomCheck(id = c.session) else "at the door"
}
$when events.roomCheck (id: String) {
s = dom.find(cls = "Session", key = id)
e = dom.find(cls = "Event", key = s.event)
v = dom.find(cls = "Venue", key = e.venue)
cap = (v.rooms filter (x => x.name is s.room))[0].capacity
n = sizeOf(dom.list(cls = "CheckIn").data filter (x => x.session is id))
if (n > cap) {
events.tellOrganizers(text = "${s.room} is over capacity: ${n} people for ${cap} seats (\"${s.title}\")")
payload = "over"
} else {
payload = "ok"
}
}
After a session: everyone who checked into it is asked for feedback. After the event: a summary for the organizers, with attendance and the average rating.
$when events.sessionEnded (id: String) {
s = dom.find(cls = "Session", key = id)
asked = dom.list(cls = "CheckIn").data filter (x => x.session is id) map (x => events.askFeedback(registration = x.registration, title = s.title))
payload = sizeOf(asked)
}
$when events.askFeedback (registration: String, title: String) {
r = dom.find(cls = "Registration", key = registration)
a = dom.find(cls = "Attendee", key = r.attendee)
payload = events.notify(to = a.email, text = "How was \"${title}\"? Tell us in one line and a few stars.")
}
$when events.summary (event: String) {
e = dom.find(cls = "Event", key = event)
came = sizeOf(dom.list(cls = "Registration").data filter (r => r.status is "attended"))
stars = dom.list(cls = "Feedback").data map (f => f.stars)
avg = if (stars is empty) then 0.0 else (stars fold (s = 0.0) (x => s + x)) / sizeOf(stars)
events.tellOrganizers(text = "${e.name}: ${came} attended, ${sizeOf(stars)} ratings, average ${avg}")
payload = {attended: came, ratings: sizeOf(stars), average: avg}
}