app/soc/modules/ghop/models/task.py
changeset 2788 78d02dcd8eb0
parent 2703 7117c43ccf1b
child 2858 9b59d89e6707
equal deleted inserted replaced
2787:8408741aee63 2788:78d02dcd8eb0
   149       required=True, collection_name='tasks')
   149       required=True, collection_name='tasks')
   150 
   150 
   151   #: Required property which holds the state, the Task is currently in.
   151   #: Required property which holds the state, the Task is currently in.
   152   #: This is a hidden field not shown on forms. Handled by logic internally.
   152   #: This is a hidden field not shown on forms. Handled by logic internally.
   153   #: The state can be one of the following:
   153   #: The state can be one of the following:
   154   #: unapproved: If Task is created by a Mentor, this is the automatically
   154   #: Unapproved: If Task is created by a Mentor, this is the automatically
   155   #:   assigned state.
   155   #:   assigned state.
   156   #: unpublished: This Task is not published yet.
   156   #: Unpublished: This Task is not published yet.
   157   #: open: This Task is open and ready to be claimed.
   157   #: Open: This Task is open and ready to be claimed.
   158   #: reopened: This Task has been claimed but never finished and has been
   158   #: Reopened: This Task has been claimed but never finished and has been
   159   #:   reopened.
   159   #:   reopened.
   160   #: claim_requested: A Student has requested to claim this task.
   160   #: ClaimRequested: A Student has requested to claim this task.
   161   #: claimed: This Task has been claimed and someone is working on it.
   161   #: Claimed: This Task has been claimed and someone is working on it.
   162   #: action_needed: Work on this Task must be submitted for review within 
   162   #: ActionNeeded: Work on this Task must be submitted for review within 
   163   #:   24 hours.
   163   #:   24 hours.
   164   #: closed: Work on this Task has been completed to the org's content.
   164   #: Closed: Work on this Task has been completed to the org's content.
   165   #: awaiting_registration: Student has completed work on this task, but
   165   #: AwaitingRegistration: Student has completed work on this task, but
   166   #:   needs to complete Student registration before this task is closed.
   166   #:   needs to complete Student registration before this task is closed.
   167   #: needs_work: This work on this Tasks needs a bit more brushing up. This
   167   #: NeedsWork: This work on this Tasks needs a bit more brushing up. This
   168   #:   state is followed by a Mentor review.
   168   #:   state is followed by a Mentor review.
   169   #: needs_review: Student has submitted work for this task and it should
   169   #: NeedsReview: Student has submitted work for this task and it should
   170   #:   be reviewed by a Mentor.
   170   #:   be reviewed by a Mentor.
       
   171   #: Invalid: The Task is deleted either by an Org Admin/Mentor
   171   status = db.StringProperty(
   172   status = db.StringProperty(
   172       required=True, verbose_name=ugettext('Status'),
   173       required=True, verbose_name=ugettext('Status'),
   173       choices=['unapproved', 'unpublished', 'open', 'reopened', 
   174       choices=['Unapproved', 'Unpublished', 'Open', 'Reopened', 
   174                'claim_requested', 'claimed', 'action_needed', 
   175                'ClaimRequested', 'Claimed', 'ActionNeeded', 
   175                'closed', 'awaiting_registration', 'needs_work',
   176                'Closed', 'AwaitingRegistration', 'NeedsWork',
   176                'needs_review'],
   177                'NeedsReview', 'Invalid'],
   177       default='unapproved')
   178       default='Unapproved')
   178 
       
   179   #: A field which indicates if the Task was ever in the Reopened state.
       
   180   #: True indicates that its state was Reopened once, false indicated that it
       
   181   #: has never been in the Reopened state.
       
   182   was_reopened = db.BooleanProperty(default=False,
       
   183                                     verbose_name=ugettext('Has been reopened'))
       
   184 
   179 
   185   #: This field is set to the next deadline that will have consequences for
   180   #: This field is set to the next deadline that will have consequences for
   186   #: this Task. For instance this will store a DateTime property which will
   181   #: this Task. For instance this will store a DateTime property which will
   187   #: tell when this Task should be completed.
   182   #: tell when this Task should be completed.
   188   deadline = db.DateTimeProperty(required=False,
   183   deadline = db.DateTimeProperty(required=False,
   189                                  verbose_name=ugettext('Deadline'))
   184                                  verbose_name=ugettext('Deadline'))
   190 
   185 
   191   #: Required field containing the Mentor/Org Admin who created this task
   186   #: Required field containing the Mentor/Org Admin who created this task.
       
   187   #: If site developer has created the task, it is empty.
   192   created_by = db.ReferenceProperty(reference_class=soc.models.role.Role,
   188   created_by = db.ReferenceProperty(reference_class=soc.models.role.Role,
   193                                     required=True,
   189                                     required=False,
   194                                     collection_name='created_tasks',
   190                                     collection_name='created_tasks',
   195                                     verbose_name=ugettext('Created by'))
   191                                     verbose_name=ugettext('Created by'))
   196 
   192 
   197   #: Date when the proposal was created
   193   #: Date when the proposal was created
   198   created_on = db.DateTimeProperty(required=True, auto_now_add=True,
   194   created_on = db.DateTimeProperty(required=True, auto_now_add=True,
   201   #: Required field containing the Mentor/Org Admin who last edited this
   197   #: Required field containing the Mentor/Org Admin who last edited this
   202   #: task. It changes only when Mentor/Org Admin changes title, description,
   198   #: task. It changes only when Mentor/Org Admin changes title, description,
   203   #: difficulty, task_type, time_to_complete. If site developer has modified
   199   #: difficulty, task_type, time_to_complete. If site developer has modified
   204   #: the task, it is empty.
   200   #: the task, it is empty.
   205   modified_by = db.ReferenceProperty(reference_class=soc.models.role.Role,
   201   modified_by = db.ReferenceProperty(reference_class=soc.models.role.Role,
   206                                    required=True,
   202                                    required=False,
   207                                    collection_name='edited_tasks',
   203                                    collection_name='edited_tasks',
   208                                    verbose_name=ugettext('Modified by'))
   204                                    verbose_name=ugettext('Modified by'))
   209 
   205 
   210   #: Date when the proposal was last modified, should be set manually on edit
   206   #: Date when the proposal was last modified, should be set manually on edit
   211   modified_on = db.DateTimeProperty(required=True, auto_now_add=True,
   207   modified_on = db.DateTimeProperty(required=True, auto_now_add=True,
   229   #: }
   225   #: }
   230   #: First dictionary item holds the values for all the properties in this
   226   #: First dictionary item holds the values for all the properties in this
   231   #: model. The subsequent items hold the properties that changed at the
   227   #: model. The subsequent items hold the properties that changed at the
   232   #: timestamp given by the key.
   228   #: timestamp given by the key.
   233   #: Reference properties will be stored by calling str() on their Key.
   229   #: Reference properties will be stored by calling str() on their Key.
   234   history = db.TextProperty(required=True, default='')
   230   history = db.TextProperty(required=False, default='')
   235 
   231 
   236   def __init__(self, parent=None, key_name=None, 
   232   def __init__(self, parent=None, key_name=None, 
   237                app=None, **entity_values):
   233                app=None, **entity_values):
   238     """Constructor for GHOPTask Model.
   234     """Constructor for GHOPTask Model.
   239     
   235