From 039427ac566c8250a27bbcc33b61ac3153d07545 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 30 Jan 2020 00:45:32 +0000 Subject: [PATCH] --- server/AyaNova/DataList/AyaDataList.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/AyaNova/DataList/AyaDataList.cs b/server/AyaNova/DataList/AyaDataList.cs index 4d1fbc0d..470be054 100644 --- a/server/AyaNova/DataList/AyaDataList.cs +++ b/server/AyaNova/DataList/AyaDataList.cs @@ -73,7 +73,7 @@ namespace AyaNova.DataList //Has a Enumtype? if (!string.IsNullOrEmpty(o.EnumType)) - sb.Append($",\"et\":\"{o.EnumType}\""); + sb.Append($",\"et\":\"{TrimTypeName(o.EnumType)}\""); sb.Append("}"); @@ -84,6 +84,17 @@ namespace AyaNova.DataList return JArray.Parse(sb.ToString()); } + + //used to trim an enum type down to only it's most relevant (rightmost) portion + private string TrimTypeName(string str) + { + if (str.Contains('.')) + { + return str.Substring(str.LastIndexOf('.') + 1); + } + return str; + } + //make sure the template parses and all the fields specified are really existant //this is more for dev errors or api users becuase the client shouldn't generate bad templates public bool ValidateTemplate(string template)