diff options
Diffstat (limited to 'todoist')
-rwxr-xr-x | todoist | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -92,16 +92,16 @@ def build_collaborators_list(data): collaborators = { col["full_name"].lower(): col["id"] for col in data["Collaborators"] } return collaborators -def assign_to_person(name, collaborators): +def find_candidate(name, storage): candidates = [] - for k, v in collaborators.items(): + for k, v in storage.items(): if k.find(name) != -1: candidates.append((k, v)) if len(candidates) == 0: return None, "No candidate found" elif len(candidates) > 1: clist = [ item[0] for item in candidates ] - clist.insert(0, "Multiple candidates found. Make better specification of one of them:") + clist.insert(0, "Multiple candidates found. Pick one of them:") return None, "\n".join(clist) else: return candidates[0][1], None @@ -164,9 +164,9 @@ def main(): ## Assign to person if args.assign: - aid, err = assign_to_person(args.assign.lower(), collaborators) + aid, err = find_candidate(args.assign.lower(), collaborators) if not aid: - print(err, file=sys.stderr) + print("Assign to person error:", err, file=sys.stderr) sys.exit(1) kwargs["responsible_uid"] = aid |