diff --git a/frontend/templates/project/view-person.html b/frontend/templates/project/view-person.html index a613f39..794d67e 100644 --- a/frontend/templates/project/view-person.html +++ b/frontend/templates/project/view-person.html @@ -73,9 +73,9 @@ {% for person_id, person in mapped_persons.items %} - {{person.0.citavi_uuid}} - {{person.1}} - {{person.0.global_identity}} + {{person.citavi_uuid}} + {{person}} + {{person.global_identity}} Delete Mapping diff --git a/frontend/views.py b/frontend/views.py index 4d741ec..316b520 100644 --- a/frontend/views.py +++ b/frontend/views.py @@ -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): diff --git a/service/Mapper.py b/service/Mapper.py index d293262..e649369 100644 --- a/service/Mapper.py +++ b/service/Mapper.py @@ -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() \ No newline at end of file +# Create a PersonMapper instance for public use, so ressources are not wasted. +person_mapper = PersonMapper()