horse: use straight front type in racecourse api
This commit is contained in:
+2
-3
@@ -140,8 +140,7 @@ func spansslopes(id horse.RacecourseID, evts []courseEvent, length float32) ([]h
|
||||
// Start of the straight.
|
||||
span = horse.RacecourseSpan{
|
||||
Start: evt.Distance,
|
||||
Straight: true,
|
||||
FarStraight: evt.Values[1] == 2,
|
||||
Straight: int8(evt.Values[1]),
|
||||
}
|
||||
// Continue out of the switch.
|
||||
}
|
||||
@@ -154,7 +153,7 @@ func spansslopes(id horse.RacecourseID, evts []courseEvent, length float32) ([]h
|
||||
// Longchamp 1000 (which doesn't appear to actually be used but w/e)
|
||||
// defines straights by their start positions only, so check for the
|
||||
// previous event being a straight with no end.
|
||||
if prev.Straight && prev.End == 0 {
|
||||
if prev.Straight != 0 && prev.End == 0 {
|
||||
spans[len(spans)-1].End = span.Start
|
||||
} else {
|
||||
// Otherwise, insert a new span which is neither straight nor corner.
|
||||
|
||||
+14
-19
@@ -35,7 +35,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 0,
|
||||
End: 649.9000244140625,
|
||||
Straight: true,
|
||||
Straight: 1,
|
||||
},
|
||||
{
|
||||
Start: 649.9000244140625,
|
||||
@@ -44,7 +44,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 650,
|
||||
End: 1000,
|
||||
Straight: true,
|
||||
Straight: 1,
|
||||
},
|
||||
},
|
||||
Slopes: []horse.Slope{},
|
||||
@@ -66,8 +66,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 0,
|
||||
End: 458,
|
||||
Straight: true,
|
||||
FarStraight: true,
|
||||
Straight: 2,
|
||||
},
|
||||
{
|
||||
Start: 458,
|
||||
@@ -82,7 +81,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 958,
|
||||
End: 1450,
|
||||
Straight: true,
|
||||
Straight: 1,
|
||||
},
|
||||
{
|
||||
Start: 1450,
|
||||
@@ -97,8 +96,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 1850,
|
||||
End: 2300,
|
||||
Straight: true,
|
||||
FarStraight: true,
|
||||
Straight: 2,
|
||||
},
|
||||
{
|
||||
Start: 2300,
|
||||
@@ -113,7 +111,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 2797,
|
||||
End: 3200,
|
||||
Straight: true,
|
||||
Straight: 1,
|
||||
},
|
||||
},
|
||||
Slopes: []horse.Slope{
|
||||
@@ -166,7 +164,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 0,
|
||||
End: 500,
|
||||
Straight: true,
|
||||
Straight: 1,
|
||||
},
|
||||
{
|
||||
Start: 500,
|
||||
@@ -181,8 +179,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 800,
|
||||
End: 1300,
|
||||
Straight: true,
|
||||
FarStraight: true,
|
||||
Straight: 2,
|
||||
},
|
||||
{
|
||||
Start: 1300,
|
||||
@@ -197,7 +194,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 1614,
|
||||
End: 2000,
|
||||
Straight: true,
|
||||
Straight: 1,
|
||||
},
|
||||
},
|
||||
Slopes: []horse.Slope{},
|
||||
@@ -219,8 +216,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 0,
|
||||
End: 798,
|
||||
Straight: true,
|
||||
FarStraight: true,
|
||||
Straight: 2,
|
||||
},
|
||||
{
|
||||
Start: 798,
|
||||
@@ -239,7 +235,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 1600,
|
||||
End: 2400,
|
||||
Straight: true,
|
||||
Straight: 1,
|
||||
},
|
||||
},
|
||||
Slopes: []horse.Slope{},
|
||||
@@ -265,7 +261,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 100,
|
||||
End: 500,
|
||||
Straight: true,
|
||||
Straight: 1,
|
||||
},
|
||||
{
|
||||
Start: 500,
|
||||
@@ -280,8 +276,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 900,
|
||||
End: 1300,
|
||||
Straight: true,
|
||||
FarStraight: true,
|
||||
Straight: 2,
|
||||
},
|
||||
{
|
||||
Start: 1300,
|
||||
@@ -296,7 +291,7 @@ func TestRacecourses(t *testing.T) {
|
||||
{
|
||||
Start: 1700,
|
||||
End: 2000,
|
||||
Straight: true,
|
||||
Straight: 1,
|
||||
},
|
||||
},
|
||||
Slopes: []horse.Slope{
|
||||
|
||||
@@ -46,11 +46,9 @@ type RacecourseSpan struct {
|
||||
Start float32 `json:"start"`
|
||||
// End is the distance in meters along the track at which the span ends.
|
||||
End float32 `json:"end"`
|
||||
// Straight is whether the span is formally a straight.
|
||||
Straight bool `json:"straight,omitzero"`
|
||||
// FarStraight is whether the span is the backstretch.
|
||||
// If true, then Straight is also true.
|
||||
FarStraight bool `json:"far_straight,omitzero"`
|
||||
// Straight is the straight type if the span is formally a straight.
|
||||
// 1 indicates the front stretch and 2 the backstretch.
|
||||
Straight int8 `json:"straight,omitzero"`
|
||||
// Corner is the corner number of the span, or zero if not a corner.
|
||||
Corner int8 `json:"corner,omitzero"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user