Skip to content

Commit d51ae60

Browse files
committed
fix switch track bug
1 parent 3756b6a commit d51ae60

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

server/controllers/handleSwitchTrack.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { World, Visitor, errorHandler, getCredentials } from "../utils/index.js"
33
export const handleSwitchTrack = async (req, res) => {
44
try {
55
const credentials = getCredentials(req.query);
6-
const { assetId, profileId, interactiveNonce, interactivePublicKey, urlSlug, visitorId, sceneDropId } = credentials;
6+
const { assetId, profileId, urlSlug, visitorId, sceneDropId } = credentials;
77
const { trackSceneId } = req.query;
88

99
const world = await World.create(urlSlug, { credentials });
@@ -41,6 +41,8 @@ export const handleSwitchTrack = async (req, res) => {
4141
sceneDropId,
4242
});
4343

44+
await visitor.closeIframe(assetId);
45+
4446
const numberOfCheckpoints = await world.fetchDroppedAssetsWithUniqueName({
4547
uniqueName: "race-track-checkpoint",
4648
isPartial: true,
@@ -54,8 +56,6 @@ export const handleSwitchTrack = async (req, res) => {
5456
{ analytics: [{ analyticName: "trackUpdates", profileId, uniqueKey: profileId }] },
5557
);
5658

57-
await visitor.closeIframe(assetId);
58-
5959
return res.json({ success: true });
6060
} catch (error) {
6161
return errorHandler({

server/utils/checkpoints/finishLineEntered.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { timeToValue } from "../utils.js";
44

55
export const finishLineEntered = async ({ credentials, currentElapsedTime, profileObject, raceObject, world }) => {
66
try {
7-
const { profileId, sceneDropId, urlSlug, visitorId } = credentials;
7+
const { profileId, sceneDropId, urlSlug, username, visitorId } = credentials;
88
const { checkpoints, highscore } = profileObject;
99
const allCheckpointsCompleted = raceObject.numberOfCheckpoints === Object.keys(checkpoints).length;
1010

@@ -19,6 +19,7 @@ export const finishLineEntered = async ({ credentials, currentElapsedTime, profi
1919
[`${sceneDropId}.profiles.${profileId}.elapsedTime`]: currentElapsedTime,
2020
[`${sceneDropId}.profiles.${profileId}.startTimestamp`]: null,
2121
[`${sceneDropId}.profiles.${profileId}.highscore`]: newHighscore,
22+
[`${sceneDropId}.profiles.${profileId}.username`]: username,
2223
},
2324
{ analytics: [{ analyticName: "completions", uniqueKey: profileId }] },
2425
);

0 commit comments

Comments
 (0)