Skip to content

Commit 35479fc

Browse files
committed
converted timestamps to use milliseconds instead of seconds and fixed sending over the right person_id
1 parent 6135064 commit 35479fc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/server/api/API_ingest/updated_data.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ def get_updated_contact_data():
1414
with ev_dates as
1515
(select
1616
person_id,
17-
max(case when event_type=1 then time else null end) adopt,
18-
max(case when event_type=2 then time else null end) foster_out,
17+
max(case when event_type=1 then time else null end) * 1000 adopt,
18+
max(case when event_type=2 then time else null end) * 1000 foster_out,
1919
-- max(case when event_type=3 then time else null end) rto,
20-
max(case when event_type=5 then time else null end) foster_return
20+
max(case when event_type=5 then time else null end) * 1000 foster_return
2121
2222
from
2323
sl_animal_events sla
@@ -32,7 +32,7 @@ def get_updated_contact_data():
3232
select json_agg (upd) as "cd" from (
3333
select
3434
slsf.source_id as "Contact_Record_Id__c" , -- long salesforce string
35-
slp.id as "Person_Id__c" , -- short PAWS-local shelterluv id
35+
slp.internal_id as "Person_Id__c" , -- short PAWS-local shelterluv id
3636
3737
--case
3838
-- when
@@ -45,8 +45,8 @@ def get_updated_contact_data():
4545
foster_out as "Updated_Foster_Start_Date__c",
4646
foster_return as "Updated_Foster_End_Date__c",
4747
48-
extract(epoch from min(vs.from_date)) as "Updated_First_Volunteer_Date__c",
49-
extract(epoch from max(vs.from_date)) as "Updated_Last_Volunteer_Date__c",
48+
extract(epoch from min(vs.from_date)) * 1000 as "Updated_First_Volunteer_Date__c",
49+
extract(epoch from max(vs.from_date)) * 1000 as "Updated_Last_Volunteer_Date__c",
5050
sum(vs.hours) as "Updated_Total_Volunteer_Hours__c",
5151
vc.source_id::integer as "Volgistics_Id__c"
5252
@@ -63,7 +63,7 @@ def get_updated_contact_data():
6363
6464
group by
6565
slsf.source_id,
66-
slp.id,
66+
slp.internal_id,
6767
vc.source_id,
6868
foster_out ,
6969
foster_return

0 commit comments

Comments
 (0)