Skip to content

Instantly share code, notes, and snippets.

@kellyelton
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kellyelton/20e0c4ded3af50df1e81 to your computer and use it in GitHub Desktop.
Save kellyelton/20e0c4ded3af50df1e81 to your computer and use it in GitHub Desktop.
New ask card
def askCard(criteria = {}, operator = None, source = "db"):
if source == "db":
realDick = Dictionary[String, List[String]]()
for (propKey, propValue) in criteria.items():
if type(propValue) is list:
realDick[propKey] = List[String](propValue)
else:
realDick[propKey] = List[String]([propValue])
apiResult = _api.AskCard(realDick,operator)
if apiResult == None: return (None, 0)
return (apiResult.Item1, apiResult.Item2)
else if source == "list":
realList = List[String]([c.model for c in criteria])
apiResult = _api.SelectCard(realList)
if apiResult == None: return
return criteria[apiResult]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment