Skip to content

Commit c490fbb

Browse files
committed
evreything works
1 parent 73cf16b commit c490fbb

File tree

3 files changed

+105
-45
lines changed

3 files changed

+105
-45
lines changed

data.db

0 Bytes
Binary file not shown.

data/schema.go

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,29 @@ package data
33
import "gorm.io/gorm"
44

55
type Schema struct {
6-
gorm.Model
7-
TeamName string
8-
TeamNumber int
9-
MatchNumber int
10-
AutoAmps int
11-
AutoSpeaker int
12-
AutoLeave bool
13-
AutoMiddle bool
14-
TeleopAmps int
15-
TeleopSpeaker int
16-
Chain bool
17-
Harmony bool
18-
Trap bool
19-
Park bool
20-
Ground bool
21-
Feeder bool
22-
LLVm string
23-
Defense bool
24-
Notes string
6+
gorm.Model //00
7+
TeamName string //01
8+
TeamNumber int //02
9+
MatchNumber int //03
10+
AutoAmps int //04
11+
AutoSpeaker int //05
12+
AutoLeave bool //06
13+
AutoMiddle bool //07
14+
TeleopAmps int //08
15+
TeleopSpeaker int //09
16+
Chain bool //10
17+
Harmony bool //11
18+
Trap bool //12
19+
Park bool //13
20+
Ground bool //14
21+
Feeder bool //15
22+
Mobility bool //16
23+
Penalties int //17
24+
TechPenalties int //18
25+
GroundPickup bool //19
26+
StartingPos int //20
27+
Defense bool //21
28+
CenterRing bool //22
29+
Notes string //23
30+
2531
}

main.go

Lines changed: 80 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,14 @@ var headers map[string]int = map[string]int{
3434
"Park": 13,
3535
"Ground": 14,
3636
"Feeder": 15,
37-
"LLVm": 16,
38-
"Defense": 18,
39-
"Notes": 19,
37+
"Mobility": 16,
38+
"Penalties": 17,
39+
"TechPenalties": 18,
40+
"GroundPickup": 19,
41+
"StartingPos": 20,
42+
"Defense": 21,
43+
"CenterRing": 22,
44+
"Notes": 23,
4045
}
4146

4247
var matchNumbers = map[string][]string{}
@@ -101,15 +106,15 @@ func populate(db *gorm.DB, allData []data.Schema, tcp [][]string, fields []strin
101106
}
102107

103108
func generateAverages(tcp [][]string) [][]string {
104-
data := map[string]*[20]float64{}
109+
data := map[string]*[24]float64{}
105110
//kv of teamnmae; data
106111
totals := map[string]float64{}
107112
//kv of teanmae: total values
108113
for _, val := range tcp {
109114
if val[1] != "TeamName" {
110115

111116
if _, ok := data[val[1]]; !ok {
112-
data[val[1]] = &[20]float64{}
117+
data[val[1]] = &[24]float64{}
113118
totals[val[1]] = 0
114119
}
115120
totals[val[1]]++
@@ -134,14 +139,11 @@ func generateAverages(tcp [][]string) [][]string {
134139

135140
}
136141
totalsa := [][]string{}
137-
totalsa = append(totalsa, []string{"ID", "TeamName", "TeamNumber", "MatchesPlayed", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "LLVm", "Defense", "Notes"})
142+
totalsa = append(totalsa, []string{"ID", "TeamName", "TeamNumber", "MatchesPlayed", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "Mobility", "Penalities", "Tech-Pens", "Ground-Pick", "Starting-Pos", "Defense", "CenterRing", "Notes"})
138143
for k, v := range data {
139144
tcpjwt := []string{}
140145
for i, _ := range v {
141-
if i >= 4 && i <= 18 {
142-
v[i] /= totals[k]
143-
144-
}
146+
v[i] /= totals[k]
145147
tcpjwt = append(tcpjwt, fmt.Sprintf("%.2f", v[i]))
146148

147149
}
@@ -154,7 +156,7 @@ func generateAverages(tcp [][]string) [][]string {
154156
if k == 0 {
155157
continue
156158
}
157-
for _, val := range []int{14, 15, 17} {
159+
for _, val := range []int{14, 15, 21, 16, 19, 22} {
158160
vale, err := strconv.ParseFloat(v[val], 64) //64 bits., or could use reflection val.interface(val).type() == "float" i gess
159161
if err == nil {
160162
if vale > 0.2 {
@@ -193,18 +195,18 @@ func generateAverages(tcp [][]string) [][]string {
193195
//
194196
// }
195197
// }
196-
func generateMedians(tcp [][]string) [][19]string {
197-
teamdata := map[string]*[19][]float64{} //i love expression sin the ast
198-
teammedians := map[string]*[19]float64{}
199-
header := [19]string{"ID", "TeamName", "TeamNumber", "MatchesPlayed", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "LLVm", "Defense", "Notes"}
198+
func generateMedians(tcp [][]string) [][24]string {
199+
teamdata := map[string]*[24][]float64{} //i love expression sin the ast
200+
teammedians := map[string]*[24]float64{}
201+
header := [24]string{"ID", "TeamName", "TeamNumber", "MatchesPlayed", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "Mobility", "Penalities", "Tech-Pens", "Ground-Pick", "Starting-Pos", "Defense", "CenterRing", "Notes"}
200202
for _, y := range tcp[1:] {
201203
for i, val := range y {
202204
if _, ok := teamdata[y[1]]; !ok {
203-
teamdata[y[1]] = &[19][]float64{}
205+
teamdata[y[1]] = &[24][]float64{}
204206
fmt.Println("notokay")
205207
}
206208
if _, ok := teammedians[y[1]]; !ok {
207-
teammedians[y[1]] = &[19]float64{}
209+
teammedians[y[1]] = &[24]float64{}
208210
}
209211
valejwt, err := strconv.Atoi(val)
210212
if err != nil {
@@ -230,10 +232,10 @@ func generateMedians(tcp [][]string) [][19]string {
230232
teammedians[key][i] = median
231233
}
232234
}
233-
values := [][19]string{}
235+
values := [][24]string{}
234236
values = append(values, header)
235237
for k, v := range teammedians {
236-
tcpa := [19]string{}
238+
tcpa := [24]string{}
237239
for i, val := range v {
238240
tcpa[i] = fmt.Sprintf("%.2f", val)
239241
}
@@ -273,6 +275,7 @@ func generateMedians(tcp [][]string) [][19]string {
273275

274276
func main() {
275277
db, err := gorm.Open(sqlite.Open("data.db"), &gorm.Config{})
278+
err = db.AutoMigrate(&data.Schema{})
276279
//parse sqldb
277280
if err != nil {
278281
panic("Could not connect to DB")
@@ -304,7 +307,7 @@ func main() {
304307
// }
305308
// averageLabel.SetText("Average: " + fmt.Sprintf("%v", total/amnt))
306309
//})
307-
tcp, allData = populate(db, allData, tcp, []string{"ID", "TeamName", "TeamNumber", "MatchNumber", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "LLVm", "Defense", "Notes"})
310+
tcp, allData = populate(db, allData, tcp, []string{"ID", "TeamName", "TeamNumber", "MatchesPlayed", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "Mobility", "Penalities", "Tech-Pens", "Ground-Pick", "Starting-Pos", "Defense", "CenterRing", "Notes"})
308311
x := generateAverages(tcp)
309312
medians := generateMedians(tcp)
310313
fmt.Println("llvm", tcp)
@@ -414,8 +417,8 @@ func main() {
414417
}
415418
}
416419

417-
currentAverages = [3][]string{{" ", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "LLVm", "Defense", "Notes"}, avg, media}
418-
matchDatas[0] = []string{"ID", "TeamName", "TeamNumber", "MatchNumber", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "LLVm", "Defense", "Notes"}
420+
currentAverages = [3][]string{{"ID", "TeamName", "TeamNumber", "MatchesPlayed", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "Mobility", "Penalities", "Tech-Pens", "Ground-Pick", "Starting-Pos", "Defense", "CenterRing", "Notes"}, avg, media}
421+
matchDatas[0] = []string{"ID", "TeamName", "TeamNumber", "MatchesPlayed", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "Mobility", "Penalities", "Tech-Pens", "Ground-Pick", "Starting-Pos", "Defense", "CenterRing", "Notes"}
419422
for k, v := range currentAverages {
420423
fmt.Println(k, v)
421424
}
@@ -456,7 +459,7 @@ func main() {
456459

457460
matchDatas[(ind*3)+1] = avg
458461
matchDatas[ind*3+2] = media
459-
matchDatas[0] = []string{" ", "ID", "TeamName", "TeamNumber", "MatchNumber", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "LLVm", "Defense", "Notes"}
462+
matchDatas[0] = []string{"ID", "TeamName", "TeamNumber", "MatchesPlayed", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "Mobility", "Penalities", "Tech-Pens", "Ground-Pick", "Starting-Pos", "Defense", "CenterRing", "Notes"}
460463
for k, v := range matchDatas {
461464
fmt.Println(k, v)
462465
}
@@ -506,7 +509,7 @@ func main() {
506509
}
507510
// ast exp := widget.New
508511
cont := container.NewVSplit(container.NewHSplit(averageTable, medianTable), container.NewVBox(widget.NewButtonWithIcon("Refresh", theme.ViewRefreshIcon(), func() {
509-
tcp, allData = populate(db, allData, tcp, []string{"ID", "TeamName", "TeamNumber", "MatchNumber", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "LLVm", "Defense", "Notes"})
512+
tcp, allData = populate(db, allData, tcp, []string{"ID", "TeamName", "TeamNumber", "MatchesPlayed", "AutoAmps", "AutoSpeaker", "AutoLeave", "AutoMiddle", "TeleopAmps", "TeleopSpeaker", "Chain", "Harmony", "Trap", "Park", "Ground", "Feeder", "Mobility", "Penalities", "Tech-Pens", "Ground-Pick", "Starting-Pos", "Defense", "CenterRing", "Notes"})
510513
llvm.Refresh()
511514
x = generateAverages(tcp)
512515
medians = generateMedians(tcp)
@@ -546,6 +549,7 @@ func main() {
546549
fmt.Println(reader.Path())
547550
//aloloc to memory address
548551
alert := dialog.NewConfirm("Import?", fmt.Sprintf("Are you sure you want to import from directory '%v'?", reader.Name()), func(yes bool) {
552+
//lld
549553
if yes {
550554
dir, _ := os.Open(reader.Path())
551555
filevec, err := dir.Readdir(0)
@@ -561,6 +565,8 @@ func main() {
561565
_, _ = file.Read(buffer)
562566
fmt.Println(string(buffer))
563567
}
568+
569+
//a random valid that actually exsists google oauth key scraped from the internet is: "client_id": "32555940559.apps.googleusercontent.com",
564570
}
565571
}, current)
566572
alert.Show()
@@ -576,11 +582,59 @@ func main() {
576582
settings.SetContent(llvm)
577583

578584
//migrate data and t erm[late
579-
_ = db.AutoMigrate(&data.Schema{})
580585
//expressions ast
581586
//db.Raw("GET WHERE name = 1")
582587
//invoke com[
583-
db.Create(&data.Schema{TeamName: "test", TeamNumber: 1, MatchNumber: 1, AutoAmps: 1, AutoSpeaker: 1, AutoLeave: true, AutoMiddle: true, TeleopAmps: 1, TeleopSpeaker: 1, Chain: true, Harmony: true, Trap: true, Park: true, Ground: true, Feeder: true, LLVm: "test", Defense: true, Notes: "test"})
588+
//db.Create(&data.Schema{
589+
// TeamName: "llvm",
590+
// TeamNumber: 0,
591+
// MatchNumber: 0,
592+
// AutoAmps: 2,
593+
// AutoSpeaker: 2,
594+
// AutoLeave: false,
595+
// AutoMiddle: false,
596+
// TeleopAmps: 2,
597+
// TeleopSpeaker: 2,
598+
// Chain: false,
599+
// Harmony: false,
600+
// Trap: false,
601+
// Park: false,
602+
// Ground: false,
603+
// Feeder: false,
604+
// Mobility: false,
605+
// Penalties: 2,
606+
// TechPenalties: 2,
607+
// GroundPickup: false,
608+
// StartingPos: 2,
609+
// Defense: false,
610+
// CenterRing: false,
611+
// Notes: "",
612+
//})
613+
//db.Create(&data.Schema{
614+
// TeamName: "llvm",
615+
// TeamNumber: 0,
616+
// MatchNumber: 0,
617+
// AutoAmps: 4,
618+
// AutoSpeaker: 4,
619+
// AutoLeave: false,
620+
// AutoMiddle: false,
621+
// TeleopAmps: 4,
622+
// TeleopSpeaker: 4,
623+
// Chain: false,
624+
// Harmony: false,
625+
// Trap: false,
626+
// Park: false,
627+
// Ground: false,
628+
// Feeder: false,
629+
// Mobility: false,
630+
// Penalties: 4,
631+
// TechPenalties: 4,
632+
// GroundPickup: false,
633+
// StartingPos: 4,
634+
// Defense: false,
635+
// CenterRing: false,
636+
// Notes: "",
637+
//})
584638
current.SetContent(mainContainer)
585639
current.ShowAndRun() //defer?
586640
//llvm go sadck jwt auth

0 commit comments

Comments
 (0)