Skip to content

Commit 52b5e9a

Browse files
committed
landing_job: add Job.is_pull_request_job field (bug 2004764)
1 parent 5015e3f commit 52b5e9a

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

src/lando/api/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ class Form(forms.Form):
258258
return JsonResponse(form.errors, 400)
259259

260260
job = LandingJob.objects.create(
261-
target_repo=target_repo, requester_email=ldap_username
261+
target_repo=target_repo,
262+
requester_email=ldap_username,
263+
is_pull_request_job=True,
262264
)
263265
author_name, author_email = pull_request.author
264266

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.2.8 on 2025-12-08 19:30
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("main", "0039_alter_repo_hooks_PreventDotGithubCheck"),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name="landingjob",
15+
name="is_pull_request_job",
16+
field=models.BooleanField(blank=True, default=False),
17+
),
18+
]

src/lando/main/models/landing_job.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ class LandingJob(BaseJob):
4646
Revision, through="RevisionLandingJob", related_name="landing_jobs"
4747
)
4848

49-
@property
50-
def is_pull_request_job(self) -> bool:
51-
"""Return True if all revisions in the landing job have a pull_number set."""
52-
return not self.revisions.filter(pull_number__isnull=True).exists()
49+
is_pull_request_job = models.BooleanField(default=False, blank=True)
5350

5451
@property
5552
def landed_phabricator_revisions(self) -> dict:

0 commit comments

Comments
 (0)