How to write a statement that counts which projects are the priority of most people
PROJECT
id
project_name
PERSON
id
person_name
PERSON_PROJECT_PRIORITY
person_fk
project_fk
prioritySet = db((
db.PERSON.id == PERSON-PROJECT-PRIORITY.person_fk) & (PROJECT.id == PERSON-PROJECT-PRIORITY.project_fk)).select()
How to sort by count of projects which have priority in order of the most persons' priority?
Output looks like this:
Paint-the-house (10) [Means is the top priority for 10 people]
Plant-a-garden (5)
Clean-out-garage (2)
If you have additional time, how to write so output looks like:
Paint-the-house (10) Tom, Sue, Tony, Ted, Mary, Fred, Sal, Chris, Ed, Sally
Plant-a-garden (5) Harry, George, Joanne, Tony, Janet
Clean-out-garage (2) Clyde, Jane
Thanks,
Alex Glaros