Skip to content

Commit

Permalink
Fixed bug in name_alternatives assignment duplicating main 'name' for…
Browse files Browse the repository at this point in the history
… places
  • Loading branch information
Sieboldianus committed Jun 5, 2018
1 parent 90095a7 commit ff1371b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
Empty file added classes/__init__.py
Empty file.
Binary file added classes/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified classes/__pycache__/helperFunctions.cpython-36.pyc
Binary file not shown.
8 changes: 7 additions & 1 deletion classes/helperFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,13 @@ def deepCompareMergeMessages(self,oldRecord,newRecord):
newEntries = value_new
else:
# only add difference (e.g. = new values)
newEntries = list(set(value_new) - set(value_old))
newEntries = list(set(value_new) - set(value_old))
if descriptor.name == "name_alternatives":
# necessary because sometimes Twitter submits English names that are not marked as English
# these get moved to name_alternatives, although they exist already as the main name
mainName = getattr(oldRecord, "name")
if mainName and mainName in newEntries:
newEntries.remove(mainName)
x = getattr(oldRecord, descriptor.name)
x.extend(newEntries)
#elif descriptor.label == descriptor.TYPE_ENUM:
Expand Down
3 changes: 1 addition & 2 deletions transferData.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
from lbsnstructure.external.timestamp_pb2 import Timestamp
import io
import sys
import shapely.geometry as geometry
from shapely.geometry.polygon import Polygon

#Old Structure in Python:
#from classes.fieldMapping import lbsnPost,lbsnPlace,lbsnUser,lbsnPostReaction
import pandas as pd
Expand Down

0 comments on commit ff1371b

Please sign in to comment.