Closed pixelspark closed 8 months ago
I'll be verbose - skip as you please :)
The error comes from this line:
type Workout struct {
[...]
Date *time.Time `gorm:"not null"`
[...]
}
The Date
field is indeed mandatory. It is set at this point when parsing a new file:
w := Workout{
[...]
Name: gpxName(gpxContent),
[...]
Date: gpxContent.Time,
[...]
}
I left the Name
line too, because this would be the way I would fix it:
gpxTime
in workouts_map.go
, similar to gpxName
gpxContent.Time
Can you work with this? Thanks in advance! If it works with some tools, feel free to create a PR to the README compatibility section!
Thanks for the elaborate explanation, will have a look this weekend! (Also: groeten uit Nederland :-))
Great project!
When importing a GPX generated by the Workoutdoors iOS app, I get this error:
constraint failed: NOT NULL constraint failed: workouts.date (1299)
.Importing a GPX generated by Strava from the same workout works. The difference appears to be that the Workoutdoors file does not have a
<time>
element under<metadata>
in the GPX, whereas the Strava one has it. The Workoutdoors file does have<time>
items under each track point:Perhaps the importer could use the earliest date in the file in case a date under metadata is missing.
I can have a go at implementing this myself if such feature would be desirable. If so any guidance on where to start would be appreciated (i.e. which part of the code to look)!