This commit is contained in:
@@ -18,6 +18,7 @@ todo: add pickers for all CORE objects (User...?)
|
||||
todo: write a guide in ayatype for what to do when making a new core object as there are a few things now
|
||||
todo: tests once it's all completed for server
|
||||
- test regular, tags, non-text column, max-results, order, template routes etc
|
||||
- test not authorized, not found
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -59,22 +59,17 @@ namespace AyaNova.Biz
|
||||
internal async Task<List<NameIdActiveItem>> GetPickListAsync(IAyaPickList PickList, string query, bool inactive)
|
||||
{
|
||||
|
||||
|
||||
|
||||
//Crack and validate the query part set a broken rule if not valid and return null
|
||||
//else do the query
|
||||
string TagSpecificQuery = null;
|
||||
string AutoCompleteQuery = null;
|
||||
|
||||
|
||||
|
||||
//Here need to handle scenario of badly formed query so user knows they did it wrong and doesn't just assume it's not there
|
||||
|
||||
//determine if this is a tag query and extract it
|
||||
bool HasQuery = !string.IsNullOrWhiteSpace(query);
|
||||
if (HasQuery)
|
||||
{
|
||||
AutoCompleteQuery=query;
|
||||
AutoCompleteQuery = query;
|
||||
//is it a dual template and tag query?
|
||||
if (AutoCompleteQuery.Contains(" "))
|
||||
{
|
||||
@@ -85,7 +80,8 @@ namespace AyaNova.Biz
|
||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "query", "LT:ErrorPickListQueryInvalid");
|
||||
return null;
|
||||
}
|
||||
// users may type several spaces in a regular query, so ignore that and only use the first two segments
|
||||
//check the two query segments, it's valid for the user to put the tag first or the template query first
|
||||
//we handle either way, but if there are no tas in either then it's not a valid query
|
||||
if (querySegments[0].Contains(".."))
|
||||
{
|
||||
TagSpecificQuery = querySegments[0].Replace("..", "");
|
||||
@@ -106,15 +102,16 @@ namespace AyaNova.Biz
|
||||
else
|
||||
{
|
||||
//is it a tag only query?
|
||||
if(AutoCompleteQuery.Contains("..")){
|
||||
TagSpecificQuery=AutoCompleteQuery.Replace("..","");
|
||||
AutoCompleteQuery=null;
|
||||
if (AutoCompleteQuery.Contains(".."))
|
||||
{
|
||||
TagSpecificQuery = AutoCompleteQuery.Replace("..", "");
|
||||
AutoCompleteQuery = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//Autocomplete and tagonly query terms now set for consumption by PickListFetcher, ready to fetch...
|
||||
|
||||
//Autocomplete and tagonly query terms now set for consumption by PickListFetcher, ready to fetch...
|
||||
List<NameIdActiveItem> items = await PickListFetcher.GetResponseAsync(PickList, AutoCompleteQuery, TagSpecificQuery, inactive, ct);
|
||||
return items;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user