added log file uploading and match results
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.haelnorr.com/h/golib/hws"
|
||||
"git.haelnorr.com/h/oslstats/internal/notify"
|
||||
@@ -91,6 +92,10 @@ func (f *FormGetter) Time(key string, format *timefmt.Format) *TimeField {
|
||||
return newTimeField(key, format, f)
|
||||
}
|
||||
|
||||
func (f *FormGetter) TimeInLocation(key string, format *timefmt.Format, loc *time.Location) *TimeField {
|
||||
return newTimeFieldInLocation(key, format, loc, f)
|
||||
}
|
||||
|
||||
func (f *FormGetter) StringList(key string) *StringList {
|
||||
return newStringList(key, f)
|
||||
}
|
||||
|
||||
@@ -31,6 +31,25 @@ func newTimeField(key string, format *timefmt.Format, g Getter) *TimeField {
|
||||
}
|
||||
}
|
||||
|
||||
func newTimeFieldInLocation(key string, format *timefmt.Format, loc *time.Location, g Getter) *TimeField {
|
||||
raw := g.Get(key)
|
||||
var startDate time.Time
|
||||
if raw != "" {
|
||||
var err error
|
||||
startDate, err = format.ParseInLocation(raw, loc)
|
||||
if err != nil {
|
||||
g.AddCheck(newFailedCheck(
|
||||
"Invalid date/time format",
|
||||
fmt.Sprintf("%s should be in format %s", key, format.LDML()),
|
||||
))
|
||||
}
|
||||
}
|
||||
return &TimeField{
|
||||
Value: startDate,
|
||||
FieldBase: newField(key, g),
|
||||
}
|
||||
}
|
||||
|
||||
func (t *TimeField) Required() *TimeField {
|
||||
if t.Value.IsZero() {
|
||||
t.getter.AddCheck(newFailedCheck(
|
||||
|
||||
Reference in New Issue
Block a user