From e47b0501c95356f8f2a690d1e73691492bfe6f20 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 16 Mar 2020 23:00:45 +0000 Subject: [PATCH] --- devdocs/todo.txt | 1 + server/AyaNova/biz/PickListBiz.cs | 21 +++++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/devdocs/todo.txt b/devdocs/todo.txt index 1b75982d..0fac9e28 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -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 diff --git a/server/AyaNova/biz/PickListBiz.cs b/server/AyaNova/biz/PickListBiz.cs index c2b41c7b..fbd34da8 100644 --- a/server/AyaNova/biz/PickListBiz.cs +++ b/server/AyaNova/biz/PickListBiz.cs @@ -59,22 +59,17 @@ namespace AyaNova.Biz internal async Task> 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 items = await PickListFetcher.GetResponseAsync(PickList, AutoCompleteQuery, TagSpecificQuery, inactive, ct); return items; }