adjust to new csv dat
This commit is contained in:
parent
e4a1832c34
commit
934cedd3d0
|
@ -11,14 +11,19 @@ var TrackSchema = new mongoose.Schema({
|
|||
numEvents: {type: Number, default: 0},
|
||||
comments: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Comment' }],
|
||||
author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
|
||||
//Date;Time;Latitude;Longitude;Course;Speed;Right;Left;Confirmed;insidePrivacyArea
|
||||
points: [ {
|
||||
date: String,
|
||||
time : String,
|
||||
latitude: Number,
|
||||
longitude: Number,
|
||||
course: Number,
|
||||
speed: Number,
|
||||
d1: Number,
|
||||
d2: Number,
|
||||
flag: Number }]
|
||||
flag: Number,
|
||||
private: Number
|
||||
}]
|
||||
}, {timestamps: true});
|
||||
|
||||
TrackSchema.plugin(uniqueValidator, {message: 'is already taken'});
|
||||
|
|
1959
package-lock.json
generated
1959
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -32,7 +32,7 @@ function addPointsToTrack(track,trackPart)
|
|||
//console.log("num:"+num);
|
||||
//console.log("end:"+end);
|
||||
if (num == 0) {
|
||||
track.points.push({ date: "dummy", time: "", latitude: "", longitude: "", d1: "", d2: "", flag: ""});
|
||||
track.points.push({ date: "dummy", time: "", latitude: "", longitude: "", course: "", speed: "", d1: "", d2: "", flag: "", private: ""});
|
||||
}
|
||||
if (num == 0) {
|
||||
track.points[track.points.length - 1].date = token;
|
||||
|
@ -61,17 +61,39 @@ function addPointsToTrack(track,trackPart)
|
|||
num++;
|
||||
}
|
||||
else if (num == 4) {
|
||||
track.points[track.points.length - 1].d1 = token;
|
||||
var f = parseFloat(token);
|
||||
if(isNaN(f))
|
||||
{
|
||||
f = parseFloat(token.substring(0,10));
|
||||
}
|
||||
track.points[track.points.length - 1].course = f;
|
||||
num++;
|
||||
}
|
||||
else if (num == 5) {
|
||||
track.points[track.points.length - 1].d2 = token;
|
||||
var f = parseFloat(token);
|
||||
if(isNaN(f))
|
||||
{
|
||||
f = parseFloat(token.substring(0,10));
|
||||
}
|
||||
track.points[track.points.length - 1].speed = f;
|
||||
num++;
|
||||
}
|
||||
else if (num == 6) {
|
||||
track.points[track.points.length - 1].d1 = token;
|
||||
num++;
|
||||
}
|
||||
else if (num == 7) {
|
||||
track.points[track.points.length - 1].d2 = token;
|
||||
num++;
|
||||
}
|
||||
else if (num == 8) {
|
||||
track.points[track.points.length - 1].flag = token;
|
||||
num++;
|
||||
}
|
||||
else if (num == 9) {
|
||||
track.points[track.points.length - 1].private = token;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue