mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 21:56:50 -04:00
Added setting to disable team info download for when there is no internet.
This commit is contained in:
@@ -7,6 +7,7 @@ CREATE TABLE event_settings (
|
||||
numelimalliances int,
|
||||
selectionround2order VARCHAR(1),
|
||||
selectionround3order VARCHAR(1),
|
||||
teaminfodownloadenabled bool,
|
||||
tbapublishingenabled bool,
|
||||
tbaeventcode VARCHAR(16),
|
||||
tbasecretid VARCHAR(255),
|
||||
|
||||
@@ -6,23 +6,24 @@
|
||||
package main
|
||||
|
||||
type EventSettings struct {
|
||||
Id int
|
||||
Name string
|
||||
Code string
|
||||
DisplayBackgroundColor string
|
||||
NumElimAlliances int
|
||||
SelectionRound2Order string
|
||||
SelectionRound3Order string
|
||||
TbaPublishingEnabled bool
|
||||
TbaEventCode string
|
||||
TbaSecretId string
|
||||
TbaSecret string
|
||||
NetworkSecurityEnabled bool
|
||||
ApAddress string
|
||||
ApUsername string
|
||||
ApPassword string
|
||||
SwitchAddress string
|
||||
SwitchPassword string
|
||||
Id int
|
||||
Name string
|
||||
Code string
|
||||
DisplayBackgroundColor string
|
||||
NumElimAlliances int
|
||||
SelectionRound2Order string
|
||||
SelectionRound3Order string
|
||||
TeamInfoDownloadEnabled bool
|
||||
TbaPublishingEnabled bool
|
||||
TbaEventCode string
|
||||
TbaSecretId string
|
||||
TbaSecret string
|
||||
NetworkSecurityEnabled bool
|
||||
ApAddress string
|
||||
ApUsername string
|
||||
ApPassword string
|
||||
SwitchAddress string
|
||||
SwitchPassword string
|
||||
}
|
||||
|
||||
const eventSettingsId = 0
|
||||
@@ -38,6 +39,7 @@ func (database *Database) GetEventSettings() (*EventSettings, error) {
|
||||
eventSettings.NumElimAlliances = 8
|
||||
eventSettings.SelectionRound2Order = "L"
|
||||
eventSettings.SelectionRound3Order = ""
|
||||
eventSettings.TeamInfoDownloadEnabled = true
|
||||
err = database.eventSettingsMap.Insert(eventSettings)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -41,6 +41,7 @@ func SettingsPostHandler(w http.ResponseWriter, r *http.Request) {
|
||||
eventSettings.NumElimAlliances = numAlliances
|
||||
eventSettings.SelectionRound2Order = r.PostFormValue("selectionRound2Order")
|
||||
eventSettings.SelectionRound3Order = r.PostFormValue("selectionRound3Order")
|
||||
eventSettings.TeamInfoDownloadEnabled = r.PostFormValue("teamInfoDownloadEnabled") == "on"
|
||||
eventSettings.TbaPublishingEnabled = r.PostFormValue("tbaPublishingEnabled") == "on"
|
||||
eventSettings.TbaEventCode = r.PostFormValue("tbaEventCode")
|
||||
eventSettings.TbaSecretId = r.PostFormValue("tbaSecretId")
|
||||
|
||||
@@ -235,7 +235,7 @@ func canModifyTeamList() bool {
|
||||
|
||||
// Returns the data for the given team number.
|
||||
func getOfficialTeamInfo(teamId int) (*Team, error) {
|
||||
if officialTeamInfo == nil {
|
||||
if officialTeamInfo == nil && eventSettings.TeamInfoDownloadEnabled {
|
||||
// Download all team info from the FIRST website if it is not cached.
|
||||
resp, err := http.Get(officialTeamInfoUrl)
|
||||
if err != nil {
|
||||
|
||||
@@ -85,6 +85,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-7 control-label">Enable Team Info Download From usfirst.org</label>
|
||||
<div class="col-lg-1 checkbox">
|
||||
<input type="checkbox" name="teamInfoDownloadEnabled"{{if .TeamInfoDownloadEnabled}} checked{{end}}>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Publishing</legend>
|
||||
|
||||
Reference in New Issue
Block a user