← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] lp:~twom/launchpad/manually-rescan-link into lp:launchpad

 

Review: Approve



Diff comments:

> 
> === modified file 'lib/lp/code/model/branch.py'
> --- lib/lp/code/model/branch.py	2018-12-10 13:54:34 +0000
> +++ lib/lp/code/model/branch.py	2019-01-23 18:15:32 +0000
> @@ -1295,6 +1298,16 @@
>              job.celeryRunOnCommit()
>          return (self.last_mirrored_id, old_scanned_id)
>  
> +    def getLatestScanJob(self):
> +        from lp.code.model.branchjob import BranchJob, BranchScanJob
> +        latest_job = IStore(BranchJob).find(
> +            BranchJob,
> +            BranchJob.branch == self,
> +            Job.date_finished != None,
> +            job_type=BranchScanJob.class_job_type).order_by(

I had to look at Storm code to confirm that mixing explicit query expressions and keyword arguments like this would work properly.  It would be better to not make the reader work so hard, by making this be "BranchJob.job_type == BranchScanJob.class_job_type" instead.

> +                Desc(Job.date_finished)).first()
> +        return latest_job
> +
>      def requestMirror(self):
>          """See `IBranch`."""
>          if self.branch_type in (BranchType.REMOTE, BranchType.HOSTED):


-- 
https://code.launchpad.net/~twom/launchpad/manually-rescan-link/+merge/362139
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.


References