@@ -4,24 +4,6 @@ import {PSUDataItem} from "@psu-common/commonTypes"
44
55import { PostDatedSQSMessageWithExistingRecords , PostDatedProcessingResult } from "./types"
66
7- // defaults to false
8- const POST_DATED_OVERRIDE = process . env . POST_DATED_OVERRIDE === "true"
9-
10- // set from environment variable POST_DATED_OVERRIDE_VALUE
11- const POST_DATED_OVERRIDE_VALUE_ENV = process . env . POST_DATED_OVERRIDE_VALUE ?? "ignore"
12- let POST_DATED_OVERRIDE_VALUE : PostDatedProcessingResult
13- switch ( POST_DATED_OVERRIDE_VALUE_ENV . toLowerCase ( ) ) {
14- case "matured" :
15- POST_DATED_OVERRIDE_VALUE = PostDatedProcessingResult . MATURED
16- break
17- case "immature" :
18- POST_DATED_OVERRIDE_VALUE = PostDatedProcessingResult . IMMATURE
19- break
20- default :
21- POST_DATED_OVERRIDE_VALUE = PostDatedProcessingResult . IGNORE
22- break
23- }
24-
257export function getMostRecentRecord (
268 existingRecords : Array < PSUDataItem >
279) : PSUDataItem {
@@ -53,12 +35,6 @@ export function processMessage(
5335 prescriptionData : message . prescriptionData ,
5436 existingRecords : message . existingRecords
5537 } )
56- if ( POST_DATED_OVERRIDE ) {
57- logger . info ( "Post-dated override is enabled, returning override value" , {
58- overrideValue : POST_DATED_OVERRIDE_VALUE
59- } )
60- return POST_DATED_OVERRIDE_VALUE
61- }
6238
6339 // The existingRecords array contains all records from the DynamoDB table
6440 // that match this prescription's PrescriptionID
@@ -141,7 +117,7 @@ export function computeTimeUntilMaturity(
141117 }
142118
143119 const lastModified = new Date ( prescriptionRecord . LastModified )
144- const currentTime = new Date ( )
120+ const currentTime = Date . now ( )
145121
146- return ( lastModified . getTime ( ) - currentTime . getTime ( ) ) / 1000
122+ return ( lastModified . getTime ( ) - currentTime ) / 1000
147123}
0 commit comments