Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Remove allow_multiple_finishes from Task models #38

Closed
wants to merge 1 commit into from

Conversation

bobsilverberg
Copy link
Contributor

Fixes #24

@Osmose
Copy link
Contributor

Osmose commented Nov 22, 2013

Just a tip, if you put "Fix #5" in a commit message it will auto-resolve issue #5.

@@ -48,28 +47,12 @@ class Task(CreatedModifiedModel):
def is_available(self):
"""Whether this task is available for users to attempt."""
now = timezone.now()
if self.end_date and now > self.end_date:
if (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could even just be:

    @property
    def is_available(self):
        """Whether this task is available for users to attempt."""
        return not (self.end_date and now > self.end_date or 
                    self.start_date and now < self.start_date)

@Osmose
Copy link
Contributor

Osmose commented Nov 22, 2013

Only thing this is missing is a migration for the database. We're using South for migrations, so running this should be all you need:

./manage.py schemamigration --auto tasks
./manage.py migrate

@bobsilverberg
Copy link
Contributor Author

Oh, I created a migration, but I guess I neglected to add it to the commit. I will fix tomorrow.

Fix start_date bug in AvailableTasksView.get_queryset

Add migration

Make is_available property more concise
@bobsilverberg
Copy link
Contributor Author

@Osmose I added the migration and fixed up the property as per your suggestion. r?

@Osmose
Copy link
Contributor

Osmose commented Nov 27, 2013

r+ 📼

Merged in b85a1da.

@Osmose Osmose closed this Nov 27, 2013
@bobsilverberg bobsilverberg deleted the issue24 branch May 6, 2015 17:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants