Skip to content

Conversation

@ecrupper
Copy link
Contributor

Existing schedule:

  {
    "id": 1,
    "repo_id": 1,
    "active": true,
    "name": "hourly",
    "entry": "0 * * * *",
    "created_at": 1641314085,
    "created_by": "octokitty",
    "updated_at": 1641314085,
    "updated_by": "octokitty",
    "scheduled_at": 0
  }

Old:

s := existingSchedule
s.SetScheduledAt(now)
_ := db.UpdateSchedule(s)

s, _ := db.GetSchedule(existingSchedule)
fmt.Println(s.GetUpdatedAt())
// ... <now> ...

New:

s := existingSchedule
s.SetScheduledAt(now)
_ := db.UpdateSchedule(s)

s, _ := db.GetSchedule(existingSchedule)
fmt.Println(s.GetUpdatedAt())
// ... 1641314085 ...

GORM auto updates updated_at. This change ensures that that field is still relevant.

RFC: separate DB function altogether, or will this boolean be fine?

@ecrupper ecrupper self-assigned this Jun 26, 2023
@ecrupper ecrupper requested a review from a team as a code owner June 26, 2023 17:04
@codecov
Copy link

codecov bot commented Jun 26, 2023

Codecov Report

Merging #894 (2f3a677) into main (45c6007) will increase coverage by 0.00%.
The diff coverage is 77.77%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #894   +/-   ##
=======================================
  Coverage   71.47%   71.48%           
=======================================
  Files         304      304           
  Lines       12436    12438    +2     
=======================================
+ Hits         8889     8891    +2     
  Misses       3116     3116           
  Partials      431      431           
Impacted Files Coverage Δ
api/schedule/create.go 8.87% <0.00%> (ø)
api/schedule/update.go 0.00% <0.00%> (ø)
database/schedule/update.go 84.21% <100.00%> (+1.85%) ⬆️

jbrockopp
jbrockopp previously approved these changes Jun 26, 2023
Copy link
Contributor

@jbrockopp jbrockopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I'm good the boolean approach

jbrockopp
jbrockopp previously approved these changes Jun 26, 2023
Copy link
Contributor

@jbrockopp jbrockopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

wass3rw3rk
wass3rw3rk previously approved these changes Jun 26, 2023
Copy link
Member

@wass3rw3rk wass3rw3rk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ecrupper ecrupper dismissed stale reviews from wass3rw3rk and jbrockopp via 2f3a677 June 26, 2023 19:42
@ecrupper ecrupper requested review from jbrockopp and wass3rw3rk June 26, 2023 19:42
Copy link
Member

@wass3rw3rk wass3rw3rk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ecrupper ecrupper merged commit 9f92c24 into main Jun 26, 2023
@ecrupper ecrupper deleted the fix-updated-at-schedules branch June 26, 2023 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants