added log file uploading and match results
This commit is contained in:
@@ -18,7 +18,8 @@ import (
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
// FixtureDetailPage renders the fixture detail page with scheduling UI and history
|
||||
// FixtureDetailPage renders the fixture detail page with scheduling UI, history,
|
||||
// result display, and team rosters
|
||||
func FixtureDetailPage(
|
||||
s *hws.Server,
|
||||
conn *db.DB,
|
||||
@@ -30,11 +31,18 @@ func FixtureDetailPage(
|
||||
return
|
||||
}
|
||||
|
||||
activeTab := r.URL.Query().Get("tab")
|
||||
if activeTab == "" {
|
||||
activeTab = "overview"
|
||||
}
|
||||
|
||||
var fixture *db.Fixture
|
||||
var currentSchedule *db.FixtureSchedule
|
||||
var history []*db.FixtureSchedule
|
||||
var canSchedule bool
|
||||
var userTeamID int
|
||||
var result *db.FixtureResult
|
||||
var rosters map[string][]*db.PlayerWithPlayStatus
|
||||
|
||||
if ok := conn.WithReadTx(s, w, r, func(ctx context.Context, tx bun.Tx) (bool, error) {
|
||||
var err error
|
||||
@@ -59,6 +67,16 @@ func FixtureDetailPage(
|
||||
if err != nil {
|
||||
return false, errors.Wrap(err, "fixture.CanSchedule")
|
||||
}
|
||||
// Fetch fixture result if it exists
|
||||
result, err = db.GetFixtureResult(ctx, tx, fixtureID)
|
||||
if err != nil {
|
||||
return false, errors.Wrap(err, "db.GetFixtureResult")
|
||||
}
|
||||
// Fetch team rosters with play status
|
||||
rosters, err = db.GetFixtureTeamRosters(ctx, tx, fixture, result)
|
||||
if err != nil {
|
||||
return false, errors.Wrap(err, "db.GetFixtureTeamRosters")
|
||||
}
|
||||
return true, nil
|
||||
}); !ok {
|
||||
return
|
||||
@@ -66,6 +84,7 @@ func FixtureDetailPage(
|
||||
|
||||
renderSafely(seasonsview.FixtureDetailPage(
|
||||
fixture, currentSchedule, history, canSchedule, userTeamID,
|
||||
result, rosters, activeTab,
|
||||
), s, r, w)
|
||||
})
|
||||
}
|
||||
@@ -88,7 +107,8 @@ func ProposeSchedule(
|
||||
}
|
||||
format := timefmt.NewBuilder().Year4().Dash().MonthNumeric2().Dash().
|
||||
DayNumeric2().T().Hour24().Colon().Minute().Build()
|
||||
scheduledTime := getter.Time("scheduled_time", format).After(time.Now()).Value
|
||||
aest, _ := time.LoadLocation("Australia/Sydney")
|
||||
scheduledTime := getter.TimeInLocation("scheduled_time", format, aest).After(time.Now()).Value
|
||||
|
||||
if !getter.ValidateAndNotify(s, w, r) {
|
||||
return
|
||||
@@ -319,7 +339,8 @@ func RescheduleFixture(
|
||||
}
|
||||
format := timefmt.NewBuilder().Year4().Dash().MonthNumeric2().Dash().
|
||||
DayNumeric2().T().Hour24().Colon().Minute().Build()
|
||||
scheduledTime := getter.Time("scheduled_time", format).After(time.Now()).Value
|
||||
aest, _ := time.LoadLocation("Australia/Sydney")
|
||||
scheduledTime := getter.TimeInLocation("scheduled_time", format, aest).After(time.Now()).Value
|
||||
reason := getter.String("reschedule_reason").TrimSpace().Required().Value
|
||||
|
||||
if !getter.ValidateAndNotify(s, w, r) {
|
||||
|
||||
Reference in New Issue
Block a user