Skip to content

Commit

Permalink
fix(suggestions): correct fields suggestions for guru prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
Kraymer committed Apr 27, 2020
1 parent dfa4133 commit d121293
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions qifqif/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def query_guru_ruler(t):
corresponding fields for the ruler to be valid.
"""
extras = sorted([k for (k, v) in t.items() if (v and not k.isdigit())])
matchable_fields = sorted(set([x for x in t if t[x] and not x.isdigit()]) - {u"category",
u"number"})

guru_ruler = {}
extras = {}
field = True
Expand All @@ -81,10 +84,12 @@ def query_guru_ruler(t):
# Update fields match indicators
print(TERM.move_y(0))
print_transaction(t, short=False, extras=extras)
field = quick_input("\nMatch on field", clear=True).lower()
field = quick_input(
"\nMatch on field", sugg=matchable_fields, clear=True
).lower()
regex = "*" in field
field = field.strip("*")
if not field or field in set(config.FIELDS_FULL.values()) - {"category"}:
if not field or field in matchable_fields:
break
# Enter match
while field:
Expand Down

0 comments on commit d121293

Please sign in to comment.