Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/composer/alphacheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (c *Composer) ComposeAlphaCheckResponse(response brevity.AlphaCheckResponse
}
}

reply := response.Callsign + ", negative contact."
reply := c.composeCallsigns(response.Callsign) + ", negative contact."
return NaturalLanguageResponse{
Subtitle: reply,
Speech: reply,
Expand Down
18 changes: 10 additions & 8 deletions pkg/composer/vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
)

func (c *Composer) ComposeVectorResponse(response brevity.VectorResponse) NaturalLanguageResponse {
callsign := c.composeCallsigns(response.Callsign)
if !response.Contact {
reply := response.Callsign + ", negative contact"
reply := callsign + ", negative contact"
return NaturalLanguageResponse{
Subtitle: reply,
Speech: reply,
Expand All @@ -18,13 +19,13 @@ func (c *Composer) ComposeVectorResponse(response brevity.VectorResponse) Natura

if !response.Status {
if response.Location == brevity.LocationTanker {
reply := response.Callsign + ", no compatible tankers available"
reply := callsign + ", no compatible tankers available"
return NaturalLanguageResponse{
Subtitle: reply,
Speech: reply,
}
}
reply := response.Callsign + ", unable to provide vector to " + response.Location
reply := callsign + ", unable to provide vector to " + response.Location
return NaturalLanguageResponse{
Subtitle: reply,
Speech: reply,
Expand All @@ -43,14 +44,14 @@ func (c *Composer) ComposeVectorResponse(response brevity.VectorResponse) Natura
return NaturalLanguageResponse{
Subtitle: fmt.Sprintf(
"%s, vector to %s, %s/%d",
response.Callsign,
callsign,
response.Location,
response.Vector.Bearing().String(),
distance,
),
Speech: fmt.Sprintf(
"%s, vector to %s, %s %d",
response.Callsign,
callsign,
response.Location,
pronounceBearing(response.Vector.Bearing()),
distance,
Expand All @@ -63,22 +64,23 @@ func (c *Composer) composeTankerVectorResponse(response brevity.VectorResponse)
log.Error().Stringer("bearing", response.BRA.Bearing()).Msg("bearing provided to composeTankerVectorResponse should be magnetic")
}

callsign := c.composeCallsigns(response.Callsign)
bearing := pronounceBearing(response.BRA.Bearing())
_range := int(response.BRA.Range().NauticalMiles())
altitude := c.composeAltitudeStacks(response.BRA.Stacks(), brevity.Unable)
altitude := c.composeAltitudeStacks(response.BRA.Stacks(), brevity.Friendly)

resp := NaturalLanguageResponse{
Subtitle: fmt.Sprintf(
"%s, nearest tanker, %s, BRA %s/%d, %s",
response.Callsign,
callsign,
response.Location,
response.BRA.Bearing().String(),
_range,
altitude,
),
Speech: fmt.Sprintf(
"%s, nearest tanker, %s, bra %s, %d, %s",
response.Callsign,
callsign,
response.Location,
bearing,
_range,
Expand Down
4 changes: 2 additions & 2 deletions pkg/composer/vector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func TestComposeVectorResponse_NoContact(t *testing.T) {
Location: "home plate",
Contact: false,
})
assert.Equal(t, "eagle 1, negative contact", resp.Subtitle)
assert.Equal(t, "eagle 1, negative contact", resp.Speech)
assert.Equal(t, "EAGLE 1, negative contact", resp.Subtitle)
assert.Equal(t, "EAGLE 1, negative contact", resp.Speech)
}

func TestComposeVectorResponse_UnableNamedLocation(t *testing.T) {
Expand Down
10 changes: 8 additions & 2 deletions pkg/controller/vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ func (c *Controller) HandleVector(ctx context.Context, request *brevity.VectorRe
Location: request.Location,
}

var trackfile *trackfiles.Trackfile
response.Callsign, trackfile, response.Contact = c.findCallsign(request.Callsign)
foundCallsign, trackfile, ok := c.findCallsign(request.Callsign)
if !ok {
response.Callsign = request.Callsign
response.Contact = false
} else {
response.Callsign = foundCallsign
response.Contact = true
}
if !response.Contact {
c.calls <- NewCall(ctx, response)
return
Expand Down
Loading