blob: 2b24cc0f2b1fd923f494722871e4c1a0492420a0 [file] [log] [blame]
declare function calculate($events){
for $event in $events
for $sponsor in $event.sponsoring_sigs
let $es := { "event": $event, "sponsor": $sponsor }
group by $sig_name := $sponsor.sig_name with $es
let $sig_sponsorship_count := count($es)
let $by_chapter :=
for $e in $es
group by $chapter_name := $e.sponsor.chapter_name with $es
return { "chapter_name": $chapter_name, "escount" : count($es) }
order by $sig_sponsorship_count desc
limit 5
return { "sig_name": $sig_name, "total_count": $sig_sponsorship_count, "chapter_breakdown": $by_chapter }
}
let $result := calculate(dataset('Events'))
return $result