rewrite classifier
This commit is contained in:
@@ -35,3 +35,22 @@ def flatten_threads(thrds, array=[], level=0):
|
||||
for t in thrds:
|
||||
array.append(flatten_threads(t,[],1))
|
||||
return array
|
||||
|
||||
def store_threads(thrds):
|
||||
for t in thrds:
|
||||
if type(t[0]) is int:
|
||||
th=db_session.query(MailThread).filter(MailThread.firstmail==t[0]).first()
|
||||
# Wenn nicht gefunden neuen anlegen
|
||||
if th == None:
|
||||
th=MailThread()
|
||||
th.firstmail=t[0]
|
||||
elif not th.body == yaml.dump(t): # Ansonsten body vergleichen
|
||||
th.body=yaml.dump(t) # body zb (27422,27506), (27450,)
|
||||
th.islabeled=False
|
||||
th.opened=True
|
||||
else:
|
||||
th.body=yaml.dump(t)
|
||||
db_session.add(th)
|
||||
db_session.commit()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user