[TASK] Removed a method that would cause twice the work.

This commit is contained in:
Jan Philipp Timme 2014-09-30 14:20:30 +02:00
parent 65b5d4fcc8
commit 2270dd23a8
3 changed files with 7 additions and 15 deletions

View File

@ -73,9 +73,9 @@
<tbody>
{% for person_id, person in mapped_persons.items %}
<tr>
<td>{{person.0.citavi_uuid}}</td>
<td>{{person.1}}</td>
<td>{{person.0.global_identity}}</td>
<td>{{person.citavi_uuid}}</td>
<td>{{person}}</td>
<td>{{person.global_identity}}</td>
<td>
<a href="#TODO" title="Enter mapping wizard starting here.">Delete Mapping</a>
</td>

View File

@ -191,7 +191,7 @@ class ProjectPersonView(ProtectedFormView, SingleObjectMixin):
project = self.object
kwargs[u'unmapped_persons'] = person_mapper.get_unmapped_identities(project)
kwargs[u'mapped_persons'] = person_mapper.get_mapped_identities_with_representation(project)
kwargs[u'mapped_persons'] = person_mapper.get_mapped_identities(project)
return super(ProjectPersonView, self).get_context_data(**kwargs)
def get(self, request, *args, **kwargs):

View File

@ -5,7 +5,7 @@ from Django import PersonIdentityManager
class PersonMapper():
""" This little guy will help you get through your day and map citavi persons against identities. """
def __init__(self):
""" Initializes ProjectManager and PersonIdentityManager. """
self._citavi_project_manager = ProjectManager()
@ -43,15 +43,6 @@ class PersonMapper():
mapped_uuid_dict[person.citavi_uuid] = person
return mapped_uuid_dict
def get_mapped_identities_with_representation(self, project):
""" Returns a uuid->person dict for all mapped persons within a project in a tuple containing a unicode representation. """
mapped_persons = self._person_identity_manager.get_mapped_identities_for_project(project)
mapped_uuid_dict = {}
for person in mapped_persons:
person_representation = self.get_representation_for_citavi_identity(person)
mapped_uuid_dict[person.citavi_uuid] = (person, person_representation)
return mapped_uuid_dict
def create_new_identity(self, project, person):
""" Creates a new identity for a given person. """
return self._person_identity_manager.create_identity(project, person.ID)
@ -79,4 +70,5 @@ class PersonMapper():
return unicode(citavi_person.ID) + u" " + unicode(citavi_person.FirstName) + u" " + unicode(citavi_person.LastName)
person_mapper = PersonMapper()
# Create a PersonMapper instance for public use, so ressources are not wasted.
person_mapper = PersonMapper()