Added several models related to the GHOP workflow.
authorMadhusudan C.S. <madhusudancs@gmail.com>
Mon, 25 May 2009 23:42:56 +0200
changeset 2347 c5a397f57d65
parent 2345 f78caf12f32d
child 2348 0edff67b472d
Added several models related to the GHOP workflow. These models will form the base of the GHOP infrastructure together with the already commited task model. Reviewed by: Lennard de Rijk
app/ghop/models/comment.py
app/ghop/models/org_prize_assignment.py
app/ghop/models/organization.py
app/ghop/models/program.py
app/ghop/models/timeline.py
app/ghop/models/work_submission.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ghop/models/comment.py	Mon May 25 23:42:56 2009 +0200
@@ -0,0 +1,40 @@
+#!/usr/bin/python2.5
+#
+# Copyright 2009 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""This module contains the GHOP specific Comment Model.
+"""
+
+__authors__ = [
+  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
+]
+
+
+from google.appengine.ext import db
+
+from django.utils.translation import ugettext
+
+import soc.models.comment
+
+
+class GHOPComment(soc.models.comment.Comment):
+  """GHOP Comment model for tasks, extends the basic Comment model.
+  """
+
+  #: Property containing the human readable string that should be
+  #: shown for the comment when something in the task changes, 
+  #: code.google.com issue tracker style
+  change_in_task = db.StringProperty(required=True,
+      verbose_name=ugettext('Changes in the task'))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ghop/models/org_prize_assignment.py	Mon May 25 23:42:56 2009 +0200
@@ -0,0 +1,54 @@
+#!/usr/bin/python2.5
+#
+# Copyright 2009 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""This module contains the GHOP PrizePerOrg Model.
+"""
+
+__authors__ = [
+  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
+]
+
+
+from google.appengine.ext import db
+
+import soc.models.base
+
+import ghop.models.organization
+import ghop.models.program
+
+
+class GHOPOrgPrizeAssignment(soc.models.base.ModelWithFieldAttributes):
+  """Model for prizes assigned to Students by an Organization.
+  """
+
+  #: Program to which these winners belong to
+  program = db.ReferenceProperty(reference_class=ghop.models.program.GHOPProgram,
+                                 required=True,
+                                 collection_name='program_prizes')
+
+  #: Organization to which these winners belong to
+  org = db.ReferenceProperty(
+      reference_class=ghop.models.organization.GHOPOrganization,
+      required=True, collection_name='organization_prizes')
+
+  #: Ordered list of winners(reference to Student entities) for the given
+  #: organization under the specified program
+  winners = db.ListProperty(item_type=db.Key, default=[])
+
+  #: unordered list of runner-ups(reference to Student entities) for the given
+  #: organization under the specified program
+  runner_ups = db.ListProperty(item_type=db.Key, default=[])
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ghop/models/organization.py	Mon May 25 23:42:56 2009 +0200
@@ -0,0 +1,35 @@
+#!/usr/bin/python2.5
+#
+# Copyright 2009 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""This module contains the GHOP specific Organization Model.
+"""
+
+__authors__ = [
+  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
+]
+
+
+from google.appengine.ext import db
+
+import soc.models.organization
+
+
+class GHOPOrganization(soc.models.organization.Organization):
+  """GHOP Organization model extends the basic Organization model.
+  """
+
+  #: Property that stores the amount of tasks the organization can publish.
+  task_quota_limit = db.IntegerProperty(required=False, default=0)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ghop/models/program.py	Mon May 25 23:42:56 2009 +0200
@@ -0,0 +1,76 @@
+#!/usr/bin/python2.5
+#
+# Copyright 2009 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""This module contains the GHOP specific Program Model.
+"""
+
+__authors__ = [
+  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
+]
+
+
+from google.appengine.ext import db
+
+from django.utils.translation import ugettext
+
+import soc.models.program
+
+
+class GHOPProgram(soc.models.program.Program):
+  """GHOP Program model extends the basic Program model.
+  """
+
+  #: Property that contains the latest date of birth before which a Student
+  #: can participate
+  student_min_age = db.DateTimeProperty(required=False)
+  student_min_age.help_text = ugettext(
+      'Minimum age of the student to sign-up. Given by the latest birthdate allowed')
+
+  #: Required property containing the number of Tasks Students can work
+  #: on simultaneously. For GHOP it is 1
+  nr_simultaneous_tasks = db.IntegerProperty(
+      required=True, default=1, 
+      verbose_name=ugettext('Simultaneous tasks'))
+  nr_simultaneous_tasks.help_text = ugettext(
+      'Number of tasks students can work on simultaneously in the program.')
+
+  #: Property containing the number of winners per Organization
+  nr_winners = db.IntegerProperty(
+      required=True, default=0,
+      verbose_name=ugettext('Winners per organization'))
+  nr_winners.help_text = ugettext(
+      'Number of winners an organization can announce.')
+
+  #: Property containing the number of runner ups per Organization
+  nr_runnerups = db.IntegerProperty(
+      required=True, default=0,
+      verbose_name=ugettext('Runner-ups per organization'))
+  nr_runnerups.help_text = ugettext(
+      'Number of runner-ups an organization can announce.')
+
+  #: A list of difficulty levels that can be assigned for each Task created
+  task_difficulties = db.StringListProperty(
+      required=True, default=[''],
+      verbose_name=ugettext('Difficulty levels'))
+  task_difficulties.help_text = ugettext(
+      'List all the difficulty levels that can be assigned to a task.')
+
+  #: A list of task types that a Task can belong to
+  task_types = db.StringListProperty(
+      required=True, default=['Any'],
+      verbose_name=ugettext('Task Types'))
+  task_rypes.help_text = ugettext(
+      'List all the types a task can be in.')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ghop/models/timeline.py	Mon May 25 23:42:56 2009 +0200
@@ -0,0 +1,62 @@
+#!/usr/bin/python2.5
+#
+# Copyright 2009 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""This module contains the GHOP specific Timeline Model.
+"""
+
+__authors__ = [
+  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
+]
+
+
+from google.appengine.ext import db
+
+from django.utils.translation import ugettext
+
+import soc.models.timeline
+
+
+class GHOPTimeline(soc.models.timeline.Timeline):
+  """GHOP Timeline model extends the basic Timeline model. It implements
+     the GHOP specific timeline entries.
+  """
+
+  task_claim_deadline = db.DateTimeProperty(
+      verbose_name=ugettext('Task Claim Deadline date'))
+  task_claim_deadline.help_text = ugettext(
+      'No tasks can be claimed after this date.'
+      'Work on claimed tasks can continue.')
+
+  stop_all_work = db.DateTimeProperty(
+      verbose_name=ugettext('Work Submission Deadline date'))
+  stop_all_work.help_text = ugettext(
+      'All work must stop by this date.')
+
+  winner_selection_start = db.DateTimeProperty(
+      verbose_name=ugettext('Winner Selection Start date'))
+  winner_selection_start.help_text = ugettext(
+      'Organizations start choosing their winners.')
+
+  winner_selection_end = db.DateTimeProperty(
+      verbose_name=ugettext('Winner Selection End date'))
+  winner_selection_end.help_text = ugettext(
+      'Organizations must have completed choosing their winners.')
+
+  winner_announcement = db.DateTimeProperty(
+      verbose_name=ugettext('Winner Announcement date'))
+  winner_announcement.help_text = ugettext(
+      'All winners are announced.')
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ghop/models/work_submission.py	Mon May 25 23:42:56 2009 +0200
@@ -0,0 +1,72 @@
+#!/usr/bin/python2.5
+#
+# Copyright 2009 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""This module contains the GHOP WorkSubmission Model.
+"""
+
+__authors__ = [
+  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
+  '"Lennard de Rijk" <ljvderijk@gmail.com>',
+]
+
+
+from google.appengine.ext import db
+
+from django.utils.translation import ugettext
+
+import soc.models.linkable
+import soc.models.user
+
+import ghop.models.program
+import ghop.models.task
+
+
+class GHOPWorkSubmission(soc.models.linkable.Linkable):
+  """Model for work submissions for a task by students.
+
+  Scope will be set to the Organization to which this work has been submitted.
+  """
+
+  #: Task to which this work was submitted
+  task = db.ReferenceProperty(reference_class=ghop.models.task.Task,
+                              required=True,
+                              collection_name='work_submissions')
+
+  #: User who submitted this work
+  user = db.ReferenceProperty(reference_class=soc.models.user.User,
+                              required=True,
+                              collection_name='work_submissions')
+
+  #: Program to which this work belongs to
+  program = db.ReferenceProperty(reference_class=ghop.models.program.GHOPProgram,
+                                 required=True,
+                                 collection_name='work_submissions')
+
+  #: Property allowing you to store information about your work
+  information = db.TextProperty(
+      required=True, verbose_name=ugettext('Info'))
+  information.help_text = ugettext(
+      'Information about the work you submit for this task')
+
+  #: Property containing an URL to this work or more information about it
+  url_to_work = db.LinkProperty(
+      required=False, verbose_name=ugettext('URL to your Work'))
+  url_to_work.help_text = ugettext(
+      'URL to a resource containing your work or more information about it')
+
+  #: Property containing the date when the work was submitted
+  submitted_on = db.DateTimeProperty(required=True, auto_now_add=True,
+                                     verbose_name=ugettext('Submitted on'))