Skip to content

Commit

Permalink
Merge pull request #16 from ninoseki/fix-received-normalization-issue
Browse files Browse the repository at this point in the history
fix: fix an issue in Received header normalization
  • Loading branch information
ninoseki committed Jul 5, 2020
2 parents 8e20266 + 9be029b commit a79186a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/factories/eml.py
Expand Up @@ -37,15 +37,15 @@ def _normalize_received(self, received: List[Dict]) -> List[Dict]:
if len(received) == 0:
return []

received = [self._normalize_received_date(r) for r in received]
received.reverse()

first = received[0]
base_date = arrow.get(first.get("date", ""))

for r in received:
normalized = self._normalize_received_date(r)
date = arrow.get(normalized.get("date", ""))
date = arrow.get(r.get("date", ""))
delay = (date - base_date).seconds
normalized["delay"] = delay
r["delay"] = delay
base_date = date

return received
Expand Down

0 comments on commit a79186a

Please sign in to comment.