Return the user entities for the host and not the host entities for now.
This is because we are not storing the host entities along with
their corresponding user entities, so there is no way we can
get to the user entities from the host entities and vice-versa.
So for now let us use the email IDs from the user entities of
the host. However, we should convert all the host entities to
have the corresponding user entity as the reference.
diff --git a/app/soc/logic/host.py b/app/soc/logic/host.py
index 07a89f4..7b6352c 100644
@@ -50,14 +50,6 @@
q = User.all()
- host_users = q.fetch(1000)
- # TODO(Madhu): to be simplified after host_for is moved from user entity
- # to host entity
- hosts = 
- for user in host_users:
- q = Host.all()
- return hosts
+ # TODO(Madhu): Return the host entities once we run the Mapreduce to convert
+ # host entities to refer to their corresponding user entities.
+ return q.fetch(1000)
diff --git a/app/soc/modules/gsoc/views/slot_transfer.py b/app/soc/modules/gsoc/views/slot_transfer.py
index ccf28e9..d8764d6 100644
@@ -197,9 +197,14 @@
slot_transfer_entity = ent
- host_entities = host_logic.getHostsForProgram(self.data.program)
- to_emails = [i.parent().account.email() for i in host_entities
- if i.notify_slot_transfer]
+ # TODO(Madhu): This should return the host entities and not the user
+ # entities and we should check for host.notify_slot_transfer before
+ # sending the email. But at the moment we haved saved all our hosts
+ # without reference to their user entities as parents, so we don't
+ # have a way to get the relationship between the user entities and
+ # the host entities. So use the user entities for now.
+ host_users = host_logic.getHostsForProgram(self.data.program)
+ to_emails = [u.account.email() for u in host_users]
update = False