blob: 23fb4b24559143b453eff3a7b7c7562893f8f9d4 [file] [log] [blame]
vinayakb38b7ca42012-03-05 05:44:15 +00001for $event in dataset('Event')
2for $sponsor in $event.sponsoring_sigs
3let $es := { "event": $event, "sponsor": $sponsor }
4group by $sig_name := $sponsor.sig_name with $es
5let $sig_sponsorship_count := count($es)
6let $by_chapter :=
7 for $e in $es
8 group by $chapter_name := $e.sponsor.chapter_name with $es
9 return { "chapter_name": $chapter_name, "escount" : count($es) }
10order by $sig_sponsorship_count desc
11limit 5 offset 2
12return { "sig_name": $sig_name, "total_count": $sig_sponsorship_count, "chapter_breakdown": $by_chapter }