This commit is contained in:
2018-09-18 14:50:13 +00:00
parent 39594f8de8
commit 0945f732b2
3 changed files with 48 additions and 9 deletions

View File

@@ -110,13 +110,13 @@ namespace AyaNova.Api.Controllers
#if (DEBUG)
/// <summary>
/// Get all unique Locale keys that were tracked
/// Get a coverage report of locale keys used versus unused
/// Required roles: Any
///
/// </summary>
/// <returns>List in alphabetical order of all unique locale keys requested since last server reboot</returns>
[HttpGet("RequestedKeyList")]
public ActionResult RequestedKeyList()
/// <returns>Report of all unique locale keys requested since last server reboot</returns>
[HttpGet("LocaleKeyCoverage")]
public ActionResult LocaleKeyCoverage()
{
if (serverState.IsClosed)
{
@@ -126,7 +126,7 @@ namespace AyaNova.Api.Controllers
//Instantiate the business object handler
LocaleBiz biz = new LocaleBiz(ct, UserIdFromContext.Id(HttpContext.Items), UserRolesFromContext.Roles(HttpContext.Items));
var l = biz.RequestedKeyList();
var l = biz.LocaleKeyCoverage();
return Ok(new ApiOkResponse(l));
}
#endif
@@ -420,5 +420,22 @@ namespace AyaNova.Api.Controllers
}
#if (DEBUG)
public class LocaleCoverageInfo
{
public List<string> RequestedKeys { get; set; }
public int RequestedKeyCount { get; set; }
public List<string> NotRequestedKeys { get; set; }
public int NotRequestedKeyCount { get; set; }
public LocaleCoverageInfo()
{
RequestedKeys = new List<string>();
NotRequestedKeys = new List<string>();
}
}
#endif
}
}

View File

@@ -98,9 +98,24 @@ namespace AyaNova.Biz
#if (DEBUG)
internal List<string> RequestedKeyList()
internal AyaNova.Api.Controllers.LocaleController.LocaleCoverageInfo LocaleKeyCoverage()
{
return ServerBootConfig.LocaleKeysRequested;
AyaNova.Api.Controllers.LocaleController.LocaleCoverageInfo L = new AyaNova.Api.Controllers.LocaleController.LocaleCoverageInfo();
L.RequestedKeys = ServerBootConfig.LocaleKeysRequested;
L.RequestedKeys.Sort();
var AllKeys = GetKeyList();
foreach (string StockKey in AllKeys)
{
if (!L.RequestedKeys.Contains(StockKey))
{
L.NotRequestedKeys.Add(StockKey);
}
}
L.NotRequestedKeys.Sort();
L.RequestedKeyCount = L.RequestedKeys.Count;
L.NotRequestedKeyCount = L.NotRequestedKeys.Count;
return L;
}
//Track requests for keys so we can determine which are being used and which are not