1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

fix tie color

This commit is contained in:
Chuo-Yun Yang 2019-03-04 21:15:15 -05:00
parent d48a3a6d8c
commit f334604071
2 changed files with 6 additions and 5 deletions

View File

@ -41,6 +41,7 @@ import (
"github.com/wtfutil/wtf/modules/jenkins"
"github.com/wtfutil/wtf/modules/jira"
"github.com/wtfutil/wtf/modules/mercurial"
"github.com/wtfutil/wtf/modules/nbascore"
"github.com/wtfutil/wtf/modules/newrelic"
"github.com/wtfutil/wtf/modules/opsgenie"
"github.com/wtfutil/wtf/modules/pagerduty"
@ -63,7 +64,6 @@ import (
"github.com/wtfutil/wtf/modules/weatherservices/prettyweather"
"github.com/wtfutil/wtf/modules/weatherservices/weather"
"github.com/wtfutil/wtf/modules/zendesk"
"github.com/wtfutil/wtf/modules/nbascore"
"github.com/wtfutil/wtf/wtf"
)

View File

@ -36,7 +36,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
TextWidget: wtf.NewTextWidget(app, "NBA Score", "nbascore", true),
}
widget.HelpfulWidget.SetView(widget.View)
widget.TextWidget.RefreshInt = 5
widget.TextWidget.RefreshInt = 15
widget.View.SetInputCapture(widget.keyboardIntercept)
widget.View.SetScrollable(true)
return &widget
@ -67,7 +67,7 @@ func (widget *Widget) nbascore() {
if response.StatusCode != 200 {
widget.result = err.Error()
return
} // Get data from data.nba.net and check if successful
} // Get data from data.nba.net and check if successful
contents, err := ioutil.ReadAll(response.Body)
if err != nil {
@ -108,16 +108,17 @@ func (widget *Widget) nbascore() {
}
vNum, _ := strconv.Atoi(vScore)
hNum, _ := strconv.Atoi(hScore)
hColor := ""
hColor := ""
if quarter != 0 { // Compare the score
if vNum > hNum {
vTeam = "[orange]" + vTeam
} else if hNum > vNum {
// hScore = "[orange]" + hScore
hColor = "[orange]" // For correct padding
hColor = "[orange]" // For correct padding
hTeam = hTeam + "[white]"
} else {
vTeam = "[orange]" + vTeam
hColor = "[orange]"
hTeam = hTeam + "[white]"
}
}