cache the TW type list

This commit is contained in:
Chase Tucker
2025-07-09 10:58:58 -07:00
committed by Tucker Chase (CSC FI SPS MESLEO)
parent 5830705c7d
commit 184d2c2cba

View File

@ -1711,7 +1711,6 @@ Service ConvertMVScanToJSON(ScanID, mvScan, itemURL)
SRP_JSON(objScan, 'SetValue', 'ID', @ID, 'String') SRP_JSON(objScan, 'SetValue', 'ID', @ID, 'String')
SRP_JSON(objScan, 'SetValue', 'type', {SCAN_TYPE}, 'String') SRP_JSON(objScan, 'SetValue', 'type', {SCAN_TYPE}, 'String')
SRP_JSON(objScan, 'SetValue', 'action', {ACTION}, 'String') SRP_JSON(objScan, 'SetValue', 'action', {ACTION}, 'String')
SRP_JSON(objScan, 'SetValue', 'testRunTypeId', {TEST_RUN_TYPE_ID}, 'Integer')
SRP_JSON(objScan, 'SetValue', 'acceptable', {ACCEPTABLE}, 'Boolean') SRP_JSON(objScan, 'SetValue', 'acceptable', {ACCEPTABLE}, 'Boolean')
SRP_JSON(objScan, 'SetValue', 'notAcceptableReason', {NOT_ACCEPTABLE_REASON}, 'String') SRP_JSON(objScan, 'SetValue', 'notAcceptableReason', {NOT_ACCEPTABLE_REASON}, 'String')
@ -1768,23 +1767,55 @@ Service ConvertMVScanToJSON(ScanID, mvScan, itemURL)
SRP_JSON(hTWLotArray, 'Release') SRP_JSON(hTWLotArray, 'Release')
end end
SRP_JSON(objScan, 'SetValue', 'testRunTypeId', {TEST_RUN_TYPE_ID}, 'Integer') SRP_JSON(objScan, 'SetValue', 'testRunTypeId', {TEST_RUN_TYPE_ID}, 'Integer')
// TestRun Type Option Array // TestRun Type Option Array
TestRunTypeList = Test_Run_Services('GetAllTestRunTypes') twRunTypeListCacheKey$ = 'TW_RUN_TYPE_OPTIONS'
If SRP_JSON(hTestRunTypeArray, 'New', 'Array') then jsonField$ = 1
For each TestRunTypeId in TestRunTypeList<1> using @VM setting fPos lastTickField$ = 2
hTestRunTypeObj = '' oneHourTicks$ = 3600000
If SRP_JSON(hTestRunTypeObj, 'New', 'Object') then
SRP_JSON(hTestRunTypeObj, 'SetValue', 'testRunTypeId', TestRunTypeId, 'Number') TestRunTypeOptionsJson = Xlate('APP_INFO', twRunTypeListCacheKey$, jsonField$, 'X')
SRP_JSON(hTestRunTypeObj, 'SetValue', 'testRunTypeName', TestRunTypeList<2, fPos>, 'String') LastTick = Xlate('APP_INFO', 'TW_RUN_TYPE_OPTIONS', lastTickField$, 'X')
SRP_JSON(hTestRunTypeArray, 'Add', hTestRunTypeObj) TickDiff = oneHourTicks$ + oneHourTicks$
SRP_JSON(hTestRunTypeObj, 'Release') ParsingResponse = ''
end else If TestRunTypeOptionsJson NE '' and LastTick NE '' and Num(LastTick) then
Abort = True$ TickDiff = GetTickCount() - LastTick
If TestRunTypeOptionsJson NE '' and TickDiff LT oneHourTicks$ then
ParsingResponse = SRP_JSON(hTRTypeOpts, 'Parse', TestRunTypeOptionsJson)
If ParsingResponse EQ '' then
SRP_JSON(objJSONScan, 'Set', 'testRunTypeOptions', hTRTypeOpts)
end
end
end
If LastTick EQ '' or Num(LastTick) EQ False$ or TestRunTypeOptionsJson EQ '' or TickDiff GE oneHourTicks$ or ParsingResponse NE '' then
If SRP_JSON(hTestRunTypeArray, 'New', 'Array') then
TestRunTypeList = Test_Run_Services('GetAllTestRunTypes')
For each TestRunTypeId in TestRunTypeList<1> using @VM setting fPos
hTestRunTypeObj = ''
If SRP_JSON(hTestRunTypeObj, 'New', 'Object') then
SRP_JSON(hTestRunTypeObj, 'SetValue', 'testRunTypeId', TestRunTypeId, 'Number')
SRP_JSON(hTestRunTypeObj, 'SetValue', 'testRunTypeName', TestRunTypeList<2, fPos>, 'String')
SRP_JSON(hTestRunTypeArray, 'Add', hTestRunTypeObj)
SRP_JSON(hTestRunTypeObj, 'Release')
end else
Abort = True$
end
Until Abort
Next TestRunTypeId
If Abort EQ False$ then
SRP_JSON(objJSONScan, 'Set', 'testRunTypeOptions', hTestRunTypeArray)
TRTypeListJson = SRP_JSON(hTestRunTypeArray, 'Stringify', 'Fast')
LastTick = GetTickCount()
twRunTypeOptionsRec = ''
twRunTypeOptionsRec<jsonField$> = TRTypeListJson
twRunTypeOptionsRec<lastTickField$> = LastTick
Database_Services('WriteDataRow', 'APP_INFO', twRunTypeListCacheKey$, twRunTypeOptionsRec, True$, False$, False$)
end end
Until Abort
Next TestRunTypeId
If Abort EQ False$ then
SRP_JSON(objJSONScan, 'Set', 'testRunTypeOptions', hTestRunTypeArray)
end end
SRP_JSON(hTestRunTypeArray, 'Release') SRP_JSON(hTestRunTypeArray, 'Release')
end end
@ -2350,3 +2381,5 @@ return