Skip to content

Commit

Permalink
Fixed lint warning in card from/to date handling
Browse files Browse the repository at this point in the history
  • Loading branch information
twyst.development committed Sep 5, 2024
1 parent d650404 commit 509e4a2
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions system/cards/card.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,10 @@ func (c *Card) set(a *auth.Authorizator, oid schema.OID, value string, dbc db.DB
case oid == c.OID.Append(CardFrom):
if err := CanUpdate(a, c, "from", value); err != nil {
return nil, err
} else if from, err := lib.ParseDate(value); err != nil && value != "" {
return nil, err
} else {
from := lib.Date{}

if v, err := lib.ParseDate(value); err != nil && value != "" {
return nil, err
} else {
from = v
}

c.log(dbc, uid, "update", "from", c.from, value, "Updated VALID FROM date from %v to %v", c.from, value)

c.from = from
c.modified = types.TimestampNow()

Expand All @@ -288,15 +281,9 @@ func (c *Card) set(a *auth.Authorizator, oid schema.OID, value string, dbc db.DB
case oid == c.OID.Append(CardTo):
if err := CanUpdate(a, c, "to", value); err != nil {
return nil, err
} else if to, err := lib.ParseDate(value); err != nil && value != "" {
return nil, err
} else {
to := lib.Date{}

if v, err := lib.ParseDate(value); err != nil && value != "" {
return nil, err
} else {
to = v
}

c.log(dbc, uid, "update", "to", c.to, value, "Updated VALID UNTIL date from %v to %v", c.to, value)
c.to = to
c.modified = types.TimestampNow()
Expand Down

0 comments on commit 509e4a2

Please sign in to comment.