Monorepo for Tangled tangled.org

appview/db: refactor GetPulls #614

merged opened by oppi.li targeting master from push-nwrnkztxkovl

instead of using a massive left join, it now uses a few FilterIns. we can also get rid of the GetPull helper, it is a specialization of GetPulls that returns a single pull request.

Signed-off-by: oppiliappan me@oppi.li

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:qfpnj4og54vl56wngdriaxug/sh.tangled.repo.pull/3lzycfjyozu22
+6 -6
Interdiff #0 โ†’ #1
appview/db/db.go

This file has not been changed.

+6 -6
appview/db/pulls.go
··· 88 88 pull.ID = int(id) 89 89 90 90 _, err = tx.Exec(` 91 - insert into pull_submissions (pull_id, repo_at, round_number, patch, source_rev) 92 - values (?, ?, ?, ?, ?) 93 - `, pull.PullId, pull.RepoAt, 0, pull.Submissions[0].Patch, pull.Submissions[0].SourceRev) 91 + insert into pull_submissions (pull_at, round_number, patch, source_rev) 92 + values (?, ?, ?, ?) 93 + `, pull.PullAt(), 0, pull.Submissions[0].Patch, pull.Submissions[0].SourceRev) 94 94 return err 95 95 } 96 96 ··· 550 550 func ResubmitPull(e Execer, pull *models.Pull, newPatch, sourceRev string) error { 551 551 newRoundNumber := len(pull.Submissions) 552 552 _, err := e.Exec(` 553 - insert into pull_submissions (pull_id, repo_at, round_number, patch, source_rev) 554 - values (?, ?, ?, ?, ?) 555 - `, pull.PullId, pull.RepoAt, newRoundNumber, newPatch, sourceRev) 553 + insert into pull_submissions (pull_at, round_number, patch, source_rev) 554 + values (?, ?, ?, ?) 555 + `, pull.PullAt(), newRoundNumber, newPatch, sourceRev) 556 556 557 557 return err 558 558 }
appview/models/pull.go

This file has not been changed.

History

2 rounds 0 comments
sign up or login to add to the discussion
oppi.li submitted #1
1 commit
expand
appview/db: refactor GetPulls
expand 0 comments
pull request successfully merged
oppi.li submitted #0
1 commit
expand
appview/db: refactor GetPulls
expand 0 comments