Move trophies into the database.
Review Request #5767 — Created May 2, 2014 and submitted — Latest diff uploaded
Traditionally, when a trophy was awarded, it was just computed in an ad-hoc
manner every time the review request was displayed. This was fine for a basic
implementation, but made it impossible to do things like list all the trophies
that a user had been awarded, or extend the system with new trophy types.This change lays the foundation for those features by creating a Trophy model,
an extensible set of trophy types, and the code to migrate old review requests
to this new system.This is based on Behzad's change at /r/4857/. The only real changes I've made
were to clean up the rendering (through use of format_html and piggybacking
on the djblets_deco box template), include the image dimensions in the trophy
type definition, and make it work with users who don't specify their full name.
I've reproduced all of his original testing as well.
- All unit tests pass.
- Checked with review requests 1000, 1001, and 3 and trophies were displayed
correctly (or not at all). - Also tested with a new database, filled with the fill-database script.
- Tested with review request ID's 1000, 10000, 1001, 2222, and 3. Appropriate
trophies (or none at all) were awarded. The trophies' existence in the database
was manually confirmed.