Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support tracks #16

Merged
merged 1 commit into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions mockdata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"pack_format_version": 2,
"id": "le second format",
"id": "second format",
"wallet_registrations": [
{
"id": "b5fcb38a-fd16-4299-a916-d6fb123d9ec4",
Expand Down Expand Up @@ -149,10 +149,34 @@
"survey_id": "094334b0-22ee-478f-bf61-f752a2679ce5",
"answers": ["response2", "response1"]
}
],
"tracks": [
{
"locations": [
{
"accuracy": 8.201208,
"latitude": 0.963332,
"longitude": 3.3194,
"capturedAt": "2013-08-19T09:35:40Z"
}
],
"sessionId": "65252762-e161-4a1b-92f6-1d0e0f9dd6b5"
},
{
"locations": [
{
"accuracy": 28.201208,
"latitude": 0.9622482833333332,
"longitude": 37.31974508333334,
"capturedAt": "2013-08-19T09:35:40Z"
}
],
"sessionId": "65252762-e161-4a1b-92f6-1d0e0f9dd6b5"
}
]
},
{
"id": "le first format",
"id": "first format",
"registrations": [
{
"planter_identifier": "717457445",
Expand Down
15 changes: 15 additions & 0 deletions process-bulk-uploads.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const v1Requests = async (data, endpoint, httpVerb) => {
const sessions = bulkData.sessions;
const captures = bulkData.captures;
const messages = bulkData.messages;
const tracks = bulkData.tracks;
if (wallet_registrations?.length) {
console.log("processing v2 wallet_registrations");
for (const wallet_registration of wallet_registrations) {
Expand Down Expand Up @@ -138,6 +139,20 @@ const v1Requests = async (data, endpoint, httpVerb) => {
console.log("v2 sessions done");
}

if (tracks?.length) {
console.log("processing v2 tracks");
for (const track of tracks) {
try {
await v2Requests({ ...track, key }, "track", true);
} catch (e) {
shouldBeProcessed = false;
errorHandler(e, track);
continue;
}
}
console.log("v2 tracks done");
}

if (captures?.length) {
console.log("processing v2 captures");
for (const capture of captures) {
Expand Down