
__authors__ = [
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
  ]


import logging

from google.appengine.ext import db
from google.appengine.ext.mapreduce import operation

from soc.modules.gsoc.models.profile import GSoCProfile
from soc.modules.gsoc.models.project import GSoCProject


def process(project):
  if not project:
    yield operation.counters.Increment("missing_project")

  mentor =  GSoCProject.mentor.get_value_for_datastore(project)
  mentors = [mentor]
  for am in project.additional_mentors:
    if am not in mentors:
      mentors.append(am)

  project.mentors = mentors

  yield operation.db.Put(project)
  yield operation.counters.Increment("projects_updated")



__authors__ = [
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
  ]


from google.appengine.ext.mapreduce import operation

from soc.modules.gsoc.models.project import GSoCProject


def process(project):
  mentor =  GSoCProject.mentor.get_value_for_datastore(project)
  mentors = [mentor]
  for am in project.additional_mentors:
    if am not in mentors:
      mentors.append(am)

  project.mentors = mentors

  yield operation.db.Put(project)
  yield operation.counters.Increment("projects_updated")


Remove the check for existence of project since mapreduce API guarantees that.
Remove the check for existence of project since mapreduce API guarantees that.

Also remove unused imports.

  
  __authors__ = [
    '"Madhusudan.C.S" <madhusudancs@gmail.com>',
    ]
  
  
- import logging
- 
- from google.appengine.ext import db
  from google.appengine.ext.mapreduce import operation
  
- from soc.modules.gsoc.models.profile import GSoCProfile
  from soc.modules.gsoc.models.project import GSoCProject
  
  
  def process(project):
-   if not project:
-     yield operation.counters.Increment("missing_project")
- 
    mentor =  GSoCProject.mentor.get_value_for_datastore(project)
    mentors = [mentor]
    for am in project.additional_mentors:
      if am not in mentors:
        mentors.append(am)
  
    project.mentors = mentors
  
    yield operation.db.Put(project)
    yield operation.counters.Increment("projects_updated")
  
  
Remove the check for existence of project since mapreduce API guarantees that.
## Code Before:

__authors__ = [
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
  ]


import logging

from google.appengine.ext import db
from google.appengine.ext.mapreduce import operation

from soc.modules.gsoc.models.profile import GSoCProfile
from soc.modules.gsoc.models.project import GSoCProject


def process(project):
  if not project:
    yield operation.counters.Increment("missing_project")

  mentor =  GSoCProject.mentor.get_value_for_datastore(project)
  mentors = [mentor]
  for am in project.additional_mentors:
    if am not in mentors:
      mentors.append(am)

  project.mentors = mentors

  yield operation.db.Put(project)
  yield operation.counters.Increment("projects_updated")


## Instruction:
Remove the check for existence of project since mapreduce API guarantees that.
## Code After:

__authors__ = [
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
  ]


from google.appengine.ext.mapreduce import operation

from soc.modules.gsoc.models.project import GSoCProject


def process(project):
  mentor =  GSoCProject.mentor.get_value_for_datastore(project)
  mentors = [mentor]
  for am in project.additional_mentors:
    if am not in mentors:
      mentors.append(am)

  project.mentors = mentors

  yield operation.db.Put(project)
  yield operation.counters.Increment("projects_updated")

