# HG changeset patch # User Lennard de Rijk # Date 1246281568 -7200 # Node ID 0cf8f034f52dcf78f152e100339219fcd4584c01 # Parent 761906e4254de24b3df217406ce48d811a3442db Extracted the ProjectSurvey and ProjectGradingSurvey records to a new module. diff -r 761906e4254d -r 0cf8f034f52d app/soc/logic/models/survey_record.py --- a/app/soc/logic/models/survey_record.py Mon Jun 29 14:06:30 2009 +0200 +++ b/app/soc/logic/models/survey_record.py Mon Jun 29 15:19:28 2009 +0200 @@ -26,8 +26,8 @@ from soc.logic.models import work from soc.models.survey_record import SurveyRecord -from soc.models.survey_record import ProjectSurveyRecord -from soc.models.survey_record import GradingProjectSurveyRecord +from soc.models.grading_project_survey_record import GradingProjectSurveyRecord +from soc.models.project_survey_record import ProjectSurveyRecord class Logic(work.Logic): diff -r 761906e4254d -r 0cf8f034f52d app/soc/models/grading_project_survey_record.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/models/grading_project_survey_record.py Mon Jun 29 15:19:28 2009 +0200 @@ -0,0 +1,52 @@ +#!/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. + +"""GradingProjectSurveyRecord extends ProjectSurveyRecord to store the grade. +""" + +__authors__ = [ + '"Daniel Diniz" ', + '"Lennard de Rijk" ', +] + + +from google.appengine.ext import db + +from django.utils.translation import ugettext + +from soc.models.project_survey_record import ProjectSurveyRecord +from soc.models.grading_project_survey import GradingProjectSurvey + + +class GradingProjectSurveyRecord(ProjectSurveyRecord): + """Grading record for evaluation surveys. + + Represents the grading part of a evaluation survey group (usually a pair) + where the grading (e.g. Mentor's) survey is linked to a non-grading (e.g + Student's) one by a project. + """ + + #: The survey for which this entity is a record. + grading_survey = db.ReferenceProperty(GradingProjectSurvey, + collection_name="grading_survey_records") + + #: Required grade given to the project that this survey is about. + grade = db.BooleanProperty(required=True) + + def getSurvey(self): + """Returns the GradingProjectSurvey that belongs to this record. + """ + return self.grading_survey diff -r 761906e4254d -r 0cf8f034f52d app/soc/models/project_survey_record.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/models/project_survey_record.py Mon Jun 29 15:19:28 2009 +0200 @@ -0,0 +1,50 @@ +#!/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. + +"""ProjectSurveyRecord allows linking two result sets by StudentProject. +""" + +__authors__ = [ + '"Daniel Diniz" ', + '"Lennard de Rijk" ', +] + + +from google.appengine.ext import db + +from soc.models.survey_record import SurveyRecord +from soc.models.project_survey import ProjectSurvey +import soc.models.student_project + + +#TODO decide if this should inherit from BaseSurveyRecord +class ProjectSurveyRecord(SurveyRecord): + """Record linked to a Project, enabling to store which Projects had their + Survey done. + """ + + #: The survey for which this entity is a record. + project_survey = db.ReferenceProperty(ProjectSurvey, + collection_name="project_survey_records") + + #: Reference to the Project that this record belongs to. + project = db.ReferenceProperty(soc.models.student_project.StudentProject, + collection_name="survey_records") + + def getSurvey(self): + """Returns the ProjectSurvey that belongs to this record. + """ + return self.project_survey diff -r 761906e4254d -r 0cf8f034f52d app/soc/models/survey_record.py --- a/app/soc/models/survey_record.py Mon Jun 29 14:06:30 2009 +0200 +++ b/app/soc/models/survey_record.py Mon Jun 29 15:19:28 2009 +0200 @@ -15,10 +15,6 @@ # limitations under the License. """SurveyRecord represents a single Survey result. - -ProjectSurveyRecord allows linking two result sets by StudentProject. - -GradingProjectSurveyRecord stores the grade in an evaluation survey. """ __authors__ = [ @@ -33,9 +29,6 @@ from django.utils.translation import ugettext from soc.models.survey import Survey -from soc.models.grading_project_survey import GradingProjectSurvey -from soc.models.project_survey import ProjectSurvey -import soc.models.student_project import soc.models.user @@ -80,42 +73,3 @@ """Returns the Survey belonging to this record. """ return self.survey - -class ProjectSurveyRecord(SurveyRecord): - """Record linked to a Project, enabling to store which Projects had their - Survey done. - """ - - #: The survey for which this entity is a record. - project_survey = db.ReferenceProperty(ProjectSurvey, - collection_name="project_survey_records") - - #: Reference to the Project that this record belongs to. - project = db.ReferenceProperty(soc.models.student_project.StudentProject, - collection_name="survey_records") - - def getSurvey(self): - """Returns the ProjectSurvey that belongs to this record. - """ - return self.project_survey - - -class GradingProjectSurveyRecord(ProjectSurveyRecord): - """Grading record for evaluation surveys. - - Represents the grading part of a evaluation survey group (usually a pair) - where the grading (e.g. Mentor's) survey is linked to a non-grading (e.g - Student's) one by a project. - """ - - #: The survey for which this entity is a record. - grading_survey = db.ReferenceProperty(GradingProjectSurvey, - collection_name="grading_survey_records") - - #: Required grade given to the project that this survey is about. - grade = db.BooleanProperty(required=True) - - def getSurvey(self): - """Returns the GradingProjectSurvey that belongs to this record. - """ - return self.grading_survey diff -r 761906e4254d -r 0cf8f034f52d app/soc/models/survey_record_group.py --- a/app/soc/models/survey_record_group.py Mon Jun 29 14:06:30 2009 +0200 +++ b/app/soc/models/survey_record_group.py Mon Jun 29 15:19:28 2009 +0200 @@ -26,8 +26,8 @@ from google.appengine.ext import db -from soc.models.survey_record import GradingProjectSurveyRecord -from soc.models.survey_record import ProjectSurveyRecord +from soc.models.grading_project_survey_record import GradingProjectSurveyRecord +from soc.models.project_survey_record import ProjectSurveyRecord import soc.models.user