mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
Update reports for 2020.
This commit is contained in:
@@ -45,8 +45,8 @@ func (web *Web) rankingsPdfReportHandler(w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
|
||||
// The widths of the table columns in mm, stored here so that they can be referenced for each row.
|
||||
colWidths := map[string]float64{"Rank": 13, "Team": 20, "RP": 20, "Cargo": 21, "Hatch": 20, "Hab Climb": 21,
|
||||
"Sandstorm": 20, "W-L-T": 21, "DQ": 20, "Played": 20}
|
||||
colWidths := map[string]float64{"Rank": 13, "Team": 22, "RP": 23, "Auto": 23, "Endgame": 23, "Teleop": 23,
|
||||
"W-L-T": 23, "DQ": 23, "Played": 23}
|
||||
rowHeight := 6.5
|
||||
|
||||
pdf := gofpdf.New("P", "mm", "Letter", "font")
|
||||
@@ -59,10 +59,9 @@ func (web *Web) rankingsPdfReportHandler(w http.ResponseWriter, r *http.Request)
|
||||
pdf.CellFormat(colWidths["Rank"], rowHeight, "Rank", "1", 0, "C", true, 0, "")
|
||||
pdf.CellFormat(colWidths["Team"], rowHeight, "Team", "1", 0, "C", true, 0, "")
|
||||
pdf.CellFormat(colWidths["RP"], rowHeight, "RP", "1", 0, "C", true, 0, "")
|
||||
pdf.CellFormat(colWidths["Cargo"], rowHeight, "Cargo", "1", 0, "C", true, 0, "")
|
||||
pdf.CellFormat(colWidths["Hatch"], rowHeight, "Hatch", "1", 0, "C", true, 0, "")
|
||||
pdf.CellFormat(colWidths["Hab Climb"], rowHeight, "Hab Climb", "1", 0, "C", true, 0, "")
|
||||
pdf.CellFormat(colWidths["Sandstorm"], rowHeight, "Sandstorm", "1", 0, "C", true, 0, "")
|
||||
pdf.CellFormat(colWidths["Auto"], rowHeight, "Auto", "1", 0, "C", true, 0, "")
|
||||
pdf.CellFormat(colWidths["Endgame"], rowHeight, "Endgame", "1", 0, "C", true, 0, "")
|
||||
pdf.CellFormat(colWidths["Teleop"], rowHeight, "Teleop", "1", 0, "C", true, 0, "")
|
||||
pdf.CellFormat(colWidths["W-L-T"], rowHeight, "W-L-T", "1", 0, "C", true, 0, "")
|
||||
pdf.CellFormat(colWidths["DQ"], rowHeight, "DQ", "1", 0, "C", true, 0, "")
|
||||
pdf.CellFormat(colWidths["Played"], rowHeight, "Played", "1", 1, "C", true, 0, "")
|
||||
@@ -73,9 +72,9 @@ func (web *Web) rankingsPdfReportHandler(w http.ResponseWriter, r *http.Request)
|
||||
pdf.SetFont("Arial", "", 10)
|
||||
pdf.CellFormat(colWidths["Team"], rowHeight, strconv.Itoa(ranking.TeamId), "1", 0, "C", false, 0, "")
|
||||
pdf.CellFormat(colWidths["RP"], rowHeight, strconv.Itoa(ranking.RankingPoints), "1", 0, "C", false, 0, "")
|
||||
pdf.CellFormat(colWidths["Cargo"], rowHeight, strconv.Itoa(ranking.AutoPoints), "1", 0, "C", false, 0, "")
|
||||
pdf.CellFormat(colWidths["Hatch"], rowHeight, strconv.Itoa(ranking.EndgamePoints), "1", 0, "C", false, 0, "")
|
||||
pdf.CellFormat(colWidths["Hab Climb"], rowHeight, strconv.Itoa(ranking.TeleopPoints), "1", 0, "C", false, 0, "")
|
||||
pdf.CellFormat(colWidths["Auto"], rowHeight, strconv.Itoa(ranking.AutoPoints), "1", 0, "C", false, 0, "")
|
||||
pdf.CellFormat(colWidths["Endgame"], rowHeight, strconv.Itoa(ranking.EndgamePoints), "1", 0, "C", false, 0, "")
|
||||
pdf.CellFormat(colWidths["Teleop"], rowHeight, strconv.Itoa(ranking.TeleopPoints), "1", 0, "C", false, 0, "")
|
||||
record := fmt.Sprintf("%d-%d-%d", ranking.Wins, ranking.Losses, ranking.Ties)
|
||||
pdf.CellFormat(colWidths["W-L-T"], rowHeight, record, "1", 0, "C", false, 0, "")
|
||||
pdf.CellFormat(colWidths["DQ"], rowHeight, strconv.Itoa(ranking.Disqualifications), "1", 0, "C", false, 0, "")
|
||||
|
||||
@@ -22,9 +22,8 @@ func TestRankingsCsvReport(t *testing.T) {
|
||||
recorder := web.getHttpResponse("/reports/csv/rankings")
|
||||
assert.Equal(t, 200, recorder.Code)
|
||||
assert.Equal(t, "text/plain", recorder.HeaderMap["Content-Type"][0])
|
||||
expectedBody := "Rank,TeamId,RankingPoints,CargoPoints,HatchPanelPoints,HabClimbPoints,SandstormBonusPoints,Wins," +
|
||||
"Losses,Ties,Disqualifications,Played\n1,254,20,625,90,554,3,2,1,0,10\n2,1114,18,700,625,90,1,3,2,0,10" +
|
||||
"\n\n"
|
||||
expectedBody := "Rank,TeamId,RankingPoints,AutoPoints,EndgamePoints,TeleopPoints,Wins,Losses,Ties," +
|
||||
"Disqualifications,Played\n1,254,20,625,90,554,3,2,1,0,10\n2,1114,18,700,625,90,1,3,2,0,10\n\n"
|
||||
assert.Equal(t, expectedBody, recorder.Body.String())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user