[TASK] Make skip button in person map wizard work as expected.
This commit is contained in:
1 parent
ed20650289
commit
8f87fa05f9
4 files changed
+43
-13
No files matched your search
+2
-3
@@ -1,10 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from sqlalchemy import create_engine, MetaData
|
||||
from sqlalchemy import create_engine, MetaData, asc, desc
|
||||
from sqlalchemy.ext.automap import automap_base
|
||||
from sqlalchemy.orm import Session, scoped_session, sessionmaker
|
||||
|
||||
|
||||
class Project():
|
||||
""" A helper class representing a Citavi project. """
|
||||
def __init__(self, sqlite_file):
|
||||
@@ -26,7 +25,7 @@ class Project():
|
||||
""" Returns all persons from the Citavi project. """
|
||||
try:
|
||||
person_class = self._sa_sqlite_autobase.classes.Person
|
||||
citavi_persons = self._sa_sqlite_session.query(person_class).all()
|
||||
citavi_persons = self._sa_sqlite_session.query(person_class).order_by(asc('ID')).all()
|
||||
return citavi_persons
|
||||
except Exception, e:
|
||||
print e
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
|
||||
from Citavi import ProjectManager
|
||||
from Django import PersonIdentityManager
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
class PersonMapper():
|
||||
""" This little guy will help you get through your day and map citavi persons against identities. """
|
||||
@@ -25,7 +25,7 @@ class PersonMapper():
|
||||
citavi_persons = self._citavi_project_manager.get_persons_from_project(project.id)
|
||||
mapped_persons = self._person_identity_manager.get_mapped_identities_for_project(project)
|
||||
# Prepare citavi_persons into a uuid->person dict, then eliminate mapped ones. This is ugly and a little slow.
|
||||
citavi_uuid_dict = {}
|
||||
citavi_uuid_dict = OrderedDict()
|
||||
for person in citavi_persons:
|
||||
citavi_uuid_dict[person.ID] = person
|
||||
if len(mapped_persons) == 0:
|
||||
@@ -38,7 +38,7 @@ class PersonMapper():
|
||||
def get_mapped_identities(self, project):
|
||||
""" Returns a uuid->person dict for all mapped persons within a project. """
|
||||
mapped_persons = self._person_identity_manager.get_mapped_identities_for_project(project)
|
||||
mapped_uuid_dict = {}
|
||||
mapped_uuid_dict = OrderedDict()
|
||||
for person in mapped_persons:
|
||||
mapped_uuid_dict[person.citavi_uuid] = person
|
||||
return mapped_uuid_dict
|
||||
|
||||
Reference in new issue
Block a user