This commit is contained in:
2021-01-15 20:47:32 +00:00
parent 64b6e8aa74
commit 8fa01c9638
3 changed files with 10 additions and 8 deletions

View File

@@ -107,7 +107,7 @@ namespace AyaNova.Api.Controllers
return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
var o = await biz.GetAsync(id);
var o = await biz.GetAsync(id,true,true);
if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
return Ok(ApiOkResponse.Response(o));
}

View File

@@ -13,9 +13,6 @@ namespace AyaNova.PickList
internal static async Task<List<NameIdActiveItem>> GetResponseAsync(IAyaPickList PickList, string autoCompleteQuery,
string tagSpecificQuery, bool includeInactive, long[] preIds, string variant, AyContext ct, ILogger log)
{
//This may be called internally in *Biz classes who don't have a log of their own
if (log == null)
log = AyaNova.Util.ApplicationLogging.CreateLogger("PickListFetcher");
//Sort out effective Template
string Template = null;
@@ -72,6 +69,9 @@ namespace AyaNova.PickList
catch (Npgsql.PostgresException e)
{
//log out the exception and the query
//This may be called internally in *Biz classes who don't have a log of their own
if (log == null)
log = AyaNova.Util.ApplicationLogging.CreateLogger("PickListFetcher");
log.LogInformation("PickList query failed unexpectedly. Query was:");
log.LogInformation(q);
log.LogInformation(e, "DB Exception");

View File

@@ -111,11 +111,13 @@ namespace AyaNova.Biz
if (populatePartNames && ret.Items.Count > 0)
{
var partIdList = ret.Items.Select(z => z.PartId).ToList();
var partIdList = ret.Items.Select(z => z.PartId).ToArray();
var PickList = PickListFactory.GetAyaPickList(AyaType.Part);
var partNames = await PickListFetcher.GetResponseAsync(PickList, null, null, true, partIdList, null, ct, log);
var partNames = await PickListFetcher.GetResponseAsync(PickList, null, null, true, partIdList, null, ct, null);
foreach (PartAssemblyItem pai in ret.Items)
{
pai.PartDisplay = partNames.Where(z => z.Id == pai.PartId).First().Name;
}
}
return ret;
}