Create a new Ranker for each organization that is created.
Also updated seed_db. seed_db will be moved to logic module soon by SRabbelier.
Patch by: Lennard de Rijk
Reviewed by: to-be-reviewed
--- a/app/soc/logic/models/organization.py Tue Mar 03 22:45:32 2009 +0000
+++ b/app/soc/logic/models/organization.py Tue Mar 03 22:47:44 2009 +0000
@@ -27,12 +27,12 @@
from soc.logic.models import group
from soc.logic.models import org_app as org_app_logic
from soc.logic.models import program as program_logic
+from soc.logic.models import rankerroot as ranker_root_logic
from soc.logic.models import request as request_logic
import soc.models.group
import soc.models.organization
-
class Logic(group.Logic):
"""Logic methods for the Organization model.
"""
@@ -52,9 +52,15 @@
def _onCreate(self, entity):
- """Invites the group admin and backup admin.
+ """Invites the group admin and backup admin and creates a rankerroot entity.
"""
+ from soc.models import student_proposal
+
+ # create a new ranker
+ ranker_root_logic.logic.create(student_proposal.DEF_RANKER_NAME, entity,
+ student_proposal.DEF_SCORE, 100)
+
fields = {
'link_id': entity.link_id,
'scope_path': entity.scope_path
--- a/app/soc/models/seed_db.py Tue Mar 03 22:45:32 2009 +0000
+++ b/app/soc/models/seed_db.py Tue Mar 03 22:47:44 2009 +0000
@@ -29,6 +29,8 @@
from google.appengine.api import memcache
from google.appengine.ext import db
+from soc.logic.models import rankerroot
+from soc.models import student_proposal
from soc.models.document import Document
from soc.models.host import Host
from soc.models.mentor import Mentor
@@ -243,7 +245,9 @@
melange = Organization(**group_properties)
melange.put()
-
+ # create a new ranker
+ rankerroot.logic.create(student_proposal.DEF_RANKER_NAME, melange,
+ student_proposal.DEF_SCORE, 100)
group_properties.update({
'scope_path': 'google/gsoc2009',
@@ -261,6 +265,9 @@
entity = Organization(**group_properties)
entity.put()
+ # create a new ranker
+ rankerroot.logic.create(student_proposal.DEF_RANKER_NAME, entity,
+ student_proposal.DEF_SCORE, 100)
role_properties.update({