diff --git a/server/AyaNova/biz/SearchTranslationWordBreakDataCache.cs b/server/AyaNova/biz/SearchTranslationWordBreakDataCache.cs index fa1203c9..cee17c73 100644 --- a/server/AyaNova/biz/SearchTranslationWordBreakDataCache.cs +++ b/server/AyaNova/biz/SearchTranslationWordBreakDataCache.cs @@ -17,7 +17,7 @@ namespace AyaNova.Biz await semaphoreSlim.WaitAsync(); try { - if (!theCache.ContainsKey(1)) + if (!theCache.ContainsKey(id)) theCache.Add(id, await GetTranslationSearchDataAsync(id)); return theCache.First(z=>z.Key==id).Value; } diff --git a/server/AyaNova/resource/rpt/ay-report.js b/server/AyaNova/resource/rpt/ay-report.js index e64d6133..0e20be09 100644 --- a/server/AyaNova/resource/rpt/ay-report.js +++ b/server/AyaNova/resource/rpt/ay-report.js @@ -70,7 +70,8 @@ function ayRegisterHelpers() { Handlebars.registerHelper("ayT", function (translationKey) { if (ayTranslationKeyCache[translationKey] == undefined) { - return translationKey; + throw `ayT reporting helper error: the key "${translationKey}" is not present in the translation cache, did you forget to include it in your call to "await ayGetTranslations([KeyList]);" in ayPrepareData()\nTranslationKeyCache contains: ${JSON.stringify(ayTranslationKeyCache, null, 3)}?`; + // return translationKey; } return ayTranslationKeyCache[translationKey]; }); @@ -94,12 +95,15 @@ function utcDateToShortDateAndTimeLocalized(value) { return "not valid"; } - return parsedDate.toLocaleString(AYMETA.ayClientMetaData.LanguageName || "en-US", { - timeZone: AYMETA.ayClientMetaData.TimeZoneName || "America/Winnipeg", - dateStyle: "short", - timeStyle: "short", - hour12: AYMETA.ayClientMetaData.Hour12 - }); + return parsedDate.toLocaleString( + AYMETA.ayClientMetaData.LanguageName || "en-US", + { + timeZone: AYMETA.ayClientMetaData.TimeZoneName || "America/Winnipeg", + dateStyle: "short", + timeStyle: "short", + hour12: AYMETA.ayClientMetaData.Hour12 + } + ); } /////////////////////////////////////////// // Turn a utc date into a displayable @@ -118,10 +122,13 @@ function utcDateToShortDateLocalized(value) { return "not valid"; } - return parsedDate.toLocaleDateString(AYMETA.ayClientMetaData.LanguageName || "en-US", { - timeZone: AYMETA.ayClientMetaData.TimeZoneName || "America/Winnipeg", - dateStyle: "short" - }); + return parsedDate.toLocaleDateString( + AYMETA.ayClientMetaData.LanguageName || "en-US", + { + timeZone: AYMETA.ayClientMetaData.TimeZoneName || "America/Winnipeg", + dateStyle: "short" + } + ); } /////////////////////////////////////////// // Turn a utc date into a displayable @@ -140,30 +147,36 @@ function utcDateToShortTimeLocalized(value) { return "not valid"; } - return parsedDate.toLocaleTimeString(AYMETA.ayClientMetaData.LanguageName || "en-US", { - timeZone: AYMETA.ayClientMetaData.TimeZoneName || "America/Winnipeg", - timeStyle: "short", - hour12: AYMETA.ayClientMetaData.Hour12 - }); + return parsedDate.toLocaleTimeString( + AYMETA.ayClientMetaData.LanguageName || "en-US", + { + timeZone: AYMETA.ayClientMetaData.TimeZoneName || "America/Winnipeg", + timeStyle: "short", + hour12: AYMETA.ayClientMetaData.Hour12 + } + ); } /////////////////////////////////////////// // CURRENCY LOCALIZATION -// +// // function currencyLocalized(value) { if (!value) { return ""; } return new Intl.NumberFormat( - AYMETA.ayClientMetaData.LanguageName || "en-US", - { style: 'currency', currency: AYMETA.ayClientMetaData.CurrencyName || "USD" } - ).format(value) + AYMETA.ayClientMetaData.LanguageName || "en-US", + { + style: "currency", + currency: AYMETA.ayClientMetaData.CurrencyName || "USD" + } + ).format(value); } /////////////////////////////////////////// // DECIMAL LOCALIZATION -// +// // function decimalLocalized(value) { if (!value) { @@ -171,7 +184,7 @@ function decimalLocalized(value) { } return new Intl.NumberFormat( AYMETA.ayClientMetaData.LanguageName || "en-US" - ).format(value) + ).format(value); } ////////////////////////////////// @@ -252,62 +265,3 @@ async function ayPostToAPI(route, data, token) { throw error; } } - -/* -async function ayPrepareData(reportData) { - //this function (if present) is called with the report data - //before the report is rendered - //modify data as required here and return it to change the data before the report renders - - //Example of using API GET method to fetch data from API server and make it available to the report template - let route=`${reportData.ayServerMetaData.ayApiUrl}server-info`; - - //Put the data into the main report data object so it's available to the template - reportData.myData={ServerInfo:await ayGetFromAPI(route, reportData.ayClientMetaData.Authorization)}; - - //Example API POST method to fetch data from api server - route=`${reportData.ayServerMetaData.ayApiUrl}search`; - let searchPostData={phrase: "Fish"}; - reportData.myData.SearchResults=await ayPostToAPI(route, reportData.ayClientMetaData.Authorization,searchPostData); - - return reportData; -} - - - -
- -See help documentation for details
\n\t\n\tSee Report editor help documentation for details
\n\n\t