mendicant-original / puzzlenode

Quiz application inspired by Project Euler and the Internet Problem Solving Contest (IPSC)
puzzlenode.com
81 stars 43 forks source link

Puzzles need a published flag #34

Closed jordanbyron closed 13 years ago

jordanbyron commented 13 years ago

Currently puzzles are "published" on or after their release date. Because of this, some puzzles can be released before they are ready. Instead a simple boolean flag should be added to Puzzle Puzzle#published

gjp commented 13 years ago

I've got a working patch, but I'm reconsidering. There are already self.published and published? methods on the model which check the release date, which may lead to confusion. Changing the name to is_published is still a bit confusing. Also, won't a new field defaulted to false require a ninja update to prevent existing puzzles from being hidden?

We could invert this - create a "hidden" flag which is set to true on puzzle creation, and allow "published" to continue to mean a combination of date, flag, draft access, and admin.

What do you think?

jordanbyron commented 13 years ago

There are already self.published and published? methods on the model

Puzzle#published? can be removed, and Puzzle.published just needs to be re-written to look at the new published flag.

Also, won't a new field defaulted to false require a ninja update to prevent existing puzzles from being hidden?

Why don't we have the migration default the new field to false, but then also update existing Puzzles in the database who's release date <= Date.today and set their published values to true. Make sense?

jordanbyron commented 13 years ago

Fixed in Pull Request #36