Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Commit

Permalink
Add VirtualRide, correct EBikeRide ids
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmach committed Jan 23, 2016
1 parent bb4ed41 commit f5c7cee
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
18 changes: 11 additions & 7 deletions activities.go
Expand Up @@ -92,6 +92,8 @@ var ActivityTypes = struct {
Kitesurf ActivityType
Windsurf ActivityType
Swim ActivityType
VirtualRide ActivityType
EBikeRide ActivityType

WaterSport ActivityType
Canoeing ActivityType
Expand All @@ -107,13 +109,11 @@ var ActivityTypes = struct {
Yoga ActivityType
WinterSport ActivityType
CrossCountrySkiing ActivityType
EBikeRide ActivityType
}{"Ride", "AlpineSki", "BackcountrySki", "Hike", "IceSkate", "InlineSkate", "NordicSki", "RollerSki",
"Run", "Walk", "Workout", "Snowboard", "Snowshoe", "Kitesurf", "Windsurf", "Swim",
"Run", "Walk", "Workout", "Snowboard", "Snowshoe", "Kitesurf", "Windsurf", "Swim", "VirtualRide", "EBikeRide",

"WaterSport", "Canoeing", "Kayaking", "Rowing", "StandUpPaddling", "Surfing",
"Crossfit", "Elliptical", "RockClimbing", "StairStepper", "WeightTraining", "Yoga", "WinterSport", "CrossCountrySkiing",
"EBikeRide",
}

type Location [2]float64
Expand Down Expand Up @@ -428,6 +428,10 @@ func (t ActivityType) Id() int {
return 15
case ActivityTypes.Swim:
return 16
case ActivityTypes.VirtualRide:
return 17
case ActivityTypes.EBikeRide:
return 18
case ActivityTypes.WaterSport:
return 20
case ActivityTypes.Canoeing:
Expand Down Expand Up @@ -456,8 +460,6 @@ func (t ActivityType) Id() int {
return 40
case ActivityTypes.CrossCountrySkiing:
return 41
case ActivityTypes.EBikeRide:
return 42
}

return 0
Expand All @@ -467,8 +469,6 @@ func (t ActivityType) String() string {
switch t {
case ActivityTypes.Ride:
return "Ride"
case ActivityTypes.EBikeRide:
return "EBikeRide"
case ActivityTypes.AlpineSki:
return "Alpine Ski"
case ActivityTypes.BackcountrySki:
Expand Down Expand Up @@ -499,6 +499,10 @@ func (t ActivityType) String() string {
return "Windsurf"
case ActivityTypes.Swim:
return "Swim"
case ActivityTypes.VirtualRide:
return "VirtualRide"
case ActivityTypes.EBikeRide:
return "EBikeRide"
case ActivityTypes.WaterSport:
return "WaterSport"
case ActivityTypes.Canoeing:
Expand Down
23 changes: 15 additions & 8 deletions activities_test.go
Expand Up @@ -691,6 +691,21 @@ func TestActivityType(t *testing.T) {
if s := ActivityTypes.Swim.String(); s != "Swim" {
t.Errorf("activity type string incorrect, got %v", s)
}
if id := ActivityTypes.VirtualRide.Id(); id != 17 {
t.Errorf("activity type id incorrect, got %v", id)
}

if s := ActivityTypes.VirtualRide.String(); s != "VirtualRide" {
t.Errorf("activity type string incorrect, got %v", s)
}

if id := ActivityTypes.EBikeRide.Id(); id != 18 {
t.Errorf("activity type id incorrect, got %v", id)
}

if s := ActivityTypes.EBikeRide.String(); s != "EBikeRide" {
t.Errorf("activity type string incorrect, got %v", s)
}

if id := ActivityTypes.WaterSport.Id(); id != 20 {
t.Errorf("activity type id incorrect, got %v", id)
Expand Down Expand Up @@ -804,14 +819,6 @@ func TestActivityType(t *testing.T) {
t.Errorf("activity type string incorrect, got %v", s)
}

if id := ActivityTypes.EBikeRide.Id(); id != 42 {
t.Errorf("activity type id incorrect, got %v", id)
}

if s := ActivityTypes.EBikeRide.String(); s != "EBikeRide" {
t.Errorf("activity type string incorrect, got %v", s)
}

// other
ty := ActivityType(100)
if id := ty.Id(); id != 0 {
Expand Down

0 comments on commit f5c7cee

Please sign in to comment.