Unverified Commit fe1283f3 authored by Enrico Zini's avatar Enrico Zini
Browse files

Deal with model updates

parent b96f6a21
Pipeline #176769 passed with stage
in 1 minute and 56 seconds
......@@ -64,7 +64,7 @@ class Summary:
misses_files = True
if misses_files:
continue
mo = re_dir_date.match(dirpath)
if not mo:
log.error("%s: skipping path with unrecogniseable date", dirpath)
......@@ -101,10 +101,17 @@ class Summary:
for ident in identifiers:
if ident["hidden"]:
hidden_identifiers.add((ident["type"], ident["name"]))
# Load user information
for u in users:
by_email[u["email"]] = u
# Compatibility with old model
if "username" not in u:
u["username"] = u["email"]
name = u.get("username")
if name is None:
log.error("%s: no username or email found for %r", fn, u)
raise NotImplementedError("input not supported")
by_email[name] = u
u["idents"] = []
# Load association information
......@@ -119,13 +126,15 @@ class Summary:
updated = 0
unchanged = 0
for email, user in by_email.items():
history = self.users.get(email)
for username, user in by_email.items():
history = self.users.get(username)
if history is None:
new += 1
self.users[email] = [(dt, user)]
self.users[username] = [(dt, user)]
elif history[-1][0] > dt:
log.warn("%s: last seen for %s is from %s but found earlier %s: skipped", fn, email, history[-1][0], dt)
log.warn(
"%s: last seen for %s is from %s but found earlier %s: skipped",
fn, username, history[-1][0], dt)
elif history[-1][1] != user:
updated += 1
history.append((dt, user))
......@@ -133,8 +142,8 @@ class Summary:
unchanged += 1
removed = 0
for email in self.users.keys() - by_email.keys():
history = self.users.get(email)
for username in self.users.keys() - by_email.keys():
history = self.users.get(username)
if history[-1][1] is not None:
history.append((dt, None))
removed += 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment