Skip to content

Commit 08f61a7

Browse files
committed
Use the same return format in all implementations of 'getPersonFromDB'
Signed-off-by: Maximilian Löffler <s8maloef@stud.uni-saarland.de>
1 parent fbf1933 commit 08f61a7

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

codeface_utils/cluster/idManager.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,10 @@ def _query_user_id(self, name, email):
296296
raise Exception("Constructed author list is in invalid format. Duplicate entries found")
297297

298298
def getPersonFromDB(self, person_id):
299-
"""Get a PersonInfo instance from the database by ID."""
300-
if person_id not in self.persons:
301-
rows = self.df[self.df['ID'] == person_id]
302-
if len(rows) == 1:
303-
name = rows['name'].values[0]
304-
email = rows['email'].values[0]
305-
self.persons[person_id] = PersonInfo(person_id, name, email)
306-
return self.persons.get(person_id, None)
299+
rows = self.df[self.df['ID'] == person_id]
300+
if len(rows) == 1:
301+
return {
302+
'ID': person_id,
303+
'name': rows['name'].values[0],
304+
'email1': rows['email'].values[0]
305+
}

issue_processing/issue_processing.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -725,11 +725,8 @@ def get_user_from_id(idx, buffer_db=user_buffer):
725725

726726
# get person information from ID service
727727
log.info("Passing user id '{}' to ID service.".format(idx))
728-
person = idservice.getPersonFromDB(idx)
729-
user = dict()
730-
user["email"] = person.getEmail() # column "email1"
731-
user["name"] = person.getName() # column "name"
732-
user["id"] = person.getID() # column "id"
728+
user = idservice.getPersonFromDB(idx)
729+
user["email"] = user.pop("email1")
733730

734731
# add user information to buffer
735732
buffer_db[idx] = user

issue_processing/jira_issue_processing.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -639,11 +639,8 @@ def get_user_from_id(idx, buffer_db=user_buffer):
639639

640640
# get person information from ID service
641641
log.info("Passing user id '{}' to ID service.".format(idx))
642-
person = idservice.getPersonFromDB(idx)
643-
user = dict()
644-
user["email"] = person["email1"] # column "email1"
645-
user["name"] = person["name"] # column "name"
646-
user["id"] = person["id"] # column "id"
642+
user = idservice.getPersonFromDB(idx)
643+
user["email"] = user.pop("email1")
647644

648645
# add user information to buffer
649646
buffer_db[idx] = user

0 commit comments

Comments
 (0)