Organizing a competition with Plone

The following story is an attempt to show an example of how one can work with Plone in real world project. It’s based on a real product whose development I contributed to: acentoweb.competition.

The requisites

The client wanted a system to manage and organize online photo and video competitions. The competitions’ announcements and rules would be published in the site. The people who wanted to participate in a certain competition would register on it, entering their personal data, and then be able to submit photos and videos to be evaluated for the competition.

Participants should only be able to see their own submissions, and never the ones from the other participants, until the submission time is finished. The judge of every competition, a group of designed people, should be able to see all the submited items, but not their owners. The members of the judge should also be able to rate or reject each submission.

The participants shouldn’t be able to edit or add elements in the rest of the site, only in the competions they had signed up, and the sign-up form should look like if they were signing up for a competition, not like if they were creating an account for a normal Plone site.

The proposed solution

This is how we decided to implement the product in Plone. Surely there might be smarter ways, so comments to improve the product are appreciated. :)

First, we decided to create a folderish Archetypes content-type to represent a Competition, with classic title and description, and rules. Folderish because it would hold photos and videos. The photos would be just a copy of the Image type, and the videos of the File type, perhaps including some integration with p4a. Having special Photo and Video content-types ensures we can assign a custom workflow to them, as we actually need.

To ensure that the participants can only see their own submissions during the competition submission period, we create a special workflow for them, competition_item_workflow, with three states:

  • Private: The participant is still preparing the item. Only he can see and modify it.
  • Pending: The item is waiting for the judge evaluation. The participant can’t modify the item anymore. The judge can see and evaluate it now.
  • Published: The competition has ended and the items is marked for public display.

Only the participant (the owner) can trigger the submission of an item, and the judge can publish it later, which is implemented using role guards in the respective transitions.

Competitions themselves also have a dedicated workflow, competition_workflow, with states:

  • Private: In preparation. Can only be seen by the owner and the users he/she allows manually.
  • Open: The rules are published and participants can sign-up and submit their works.
  • Closed: The competition doesn’t accept new work submissions and the results are published.

Since a single person can participate in more than one competition, we decided to make the participants create a user in the site and sign-up later in each competition individually. To do so we:

  • Create a customized copy of the Plone join_form, with fields for location, phone number, and other personal data they need to enter when they sign-up.
  • Customize the Competition view to include a “Sign-up for this competition!” button, which would grant the “Competitor” local role to the user, which in turn would grant him rights to create and submit items for the competition.

To hide the author info from the judge, we customize the plone.documentbyline viewlet to hide it for users without the Modify portal content permission over an object. It’s not the most optimal solution perhaps, but it just works for now.

The judge for each competition is assigned manually for the managers of the site, assigning the “Reviewer” local role to individual users via the Sharing tab.

The rating is implemented via plone.contentratings. We created a custom category with a custom rating manager, since the default one wasn’t working properly with the permission settings we set for rating and reading the ratings: competitors and the judge can’t see the ratings of submissions before the competition is closed, and the judge can only rate works while the competition is open.

One thought on “Organizing a competition with Plone

Leave a Reply

Your email address will not be published. Required fields are marked *