fix: append to track body in /end too, and save new track in /add
This commit is contained in:
parent
33e8cbdb83
commit
7460661607
|
@ -184,6 +184,9 @@ router.post(
|
||||||
track.trackData = trackData._id;
|
track.trackData = trackData._id;
|
||||||
track.author = user;
|
track.author = user;
|
||||||
|
|
||||||
|
await track.save()
|
||||||
|
await trackData.save();
|
||||||
|
|
||||||
// remember which is the actively building track for this user
|
// remember which is the actively building track for this user
|
||||||
currentTracks.set(user.id, track._id);
|
currentTracks.set(user.id, track._id);
|
||||||
|
|
||||||
|
@ -240,6 +243,9 @@ router.post(
|
||||||
throw new Error('current user active track is gone, retry upload');
|
throw new Error('current user active track is gone, retry upload');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
track.body += req.body.track.body;
|
||||||
|
await track.save();
|
||||||
|
|
||||||
const trackData = await TrackData.findById(track.trackData);
|
const trackData = await TrackData.findById(track.trackData);
|
||||||
trackData.points = Array.from(parseTrackPoints(track.body));
|
trackData.points = Array.from(parseTrackPoints(track.body));
|
||||||
await trackData.save();
|
await trackData.save();
|
||||||
|
|
Loading…
Reference in a new issue