# HG changeset patch # User Sverre Rabbelier # Date 1243289949 -7200 # Node ID 5a5e3d84b43e88c9a671836d0aeb76874f14896b # Parent 0edff67b472d0a88164a6cfbd45e11f4874cf222# Parent d830123c1be1440db47c58871ef0a717e5855212 Merged with Sverre diff -r d830123c1be1 -r 5a5e3d84b43e app/ghop/models/comment.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/ghop/models/comment.py Tue May 26 00:19:09 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" ', +] + + +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')) diff -r d830123c1be1 -r 5a5e3d84b43e app/ghop/models/org_prize_assignment.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/ghop/models/org_prize_assignment.py Tue May 26 00:19:09 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" ', +] + + +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=[]) + diff -r d830123c1be1 -r 5a5e3d84b43e app/ghop/models/organization.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/ghop/models/organization.py Tue May 26 00:19:09 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" ', +] + + +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) diff -r d830123c1be1 -r 5a5e3d84b43e app/ghop/models/program.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/ghop/models/program.py Tue May 26 00:19:09 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" ', +] + + +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.') diff -r d830123c1be1 -r 5a5e3d84b43e app/ghop/models/task.py --- a/app/ghop/models/task.py Mon May 25 23:40:07 2009 +0200 +++ b/app/ghop/models/task.py Tue May 26 00:19:09 2009 +0200 @@ -28,14 +28,14 @@ from django.utils.translation import ugettext import soc.models.linkable -import soc.models.organization -import soc.models.program import soc.models.role import soc.models.student import soc.models.user +import ghop.models.program -class Task(soc.models.linkable.Linkable): + +class GHOPTask(soc.models.linkable.Linkable): """Model for a task used in GHOP workflow. The scope property of Linkable will be set to the Organization to which @@ -53,7 +53,7 @@ verbose_name=ugettext('Description')) description.help_text = ugettext('Complete description of the task') - #: field indicating the difficulty level of the task. This is not + #: Field indicating the difficulty level of the Task. This is not #: mandatory so the it can be assigned at any later stage. #: The options are configured by a Program Admin. difficulty = db.StringProperty(required=False, @@ -92,7 +92,7 @@ collection_name='assigned_tasks') #: Program in which this Task has been created - program = db.ReferenceProperty(reference_class=soc.models.program.Program, + program = db.ReferenceProperty(reference_class=ghop.models.program.GHOPProgram, required=True, collection_name='tasks') @@ -124,7 +124,7 @@ 'needs_review'], default='unapproved') - #: A field which indicates if the task was ever in the Reopened state. + #: A field which indicates if the Task was ever in the Reopened state. #: True indicates that its state was Reopened once, false indicated that it #: has never been in the Reopened state. was_reopened = db.BooleanProperty(default=False, diff -r d830123c1be1 -r 5a5e3d84b43e app/ghop/models/timeline.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/ghop/models/timeline.py Tue May 26 00:19:09 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" ', +] + + +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.') + diff -r d830123c1be1 -r 5a5e3d84b43e app/ghop/models/work_submission.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/ghop/models/work_submission.py Tue May 26 00:19:09 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" ', + '"Lennard de Rijk" ', +] + + +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.GHOPTask, + 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'))