From 1727bcf557d7467fb0c51b8a7068df16563df5af Mon Sep 17 00:00:00 2001 From: Adrian Kunz Date: Thu, 14 Nov 2024 14:53:03 +0100 Subject: [PATCH] feat: Default to fork:true for extra classroom search (#436) * feat: Extra search option for GitHub Classroom * feat: Default extraSearch to fork:true * style(frontend): Fix lint problems --- .../edit-assignment/classroom/classroom.component.html | 3 ++- .../modules/edit-assignment/classroom/classroom.component.ts | 4 ++-- services/apps/assignments/src/classroom/classroom.service.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/assignment/modules/edit-assignment/classroom/classroom.component.html b/frontend/src/app/assignment/modules/edit-assignment/classroom/classroom.component.html index 1bae1b0a..81ca22f0 100644 --- a/frontend/src/app/assignment/modules/edit-assignment/classroom/classroom.component.html +++ b/frontend/src/app/assignment/modules/edit-assignment/classroom/classroom.component.html @@ -23,7 +23,7 @@
org:{{classroom.org}} "{{classroom.prefix}}-" in:name -
diff --git a/frontend/src/app/assignment/modules/edit-assignment/classroom/classroom.component.ts b/frontend/src/app/assignment/modules/edit-assignment/classroom/classroom.component.ts index bb80927a..edf463b2 100644 --- a/frontend/src/app/assignment/modules/edit-assignment/classroom/classroom.component.ts +++ b/frontend/src/app/assignment/modules/edit-assignment/classroom/classroom.component.ts @@ -19,9 +19,9 @@ export class ClassroomComponent { } previewSearch() { - let url = new URL(`https://github.com/search`); + const url = new URL(`https://github.com/search`); url.searchParams.set('type', 'repositories'); - url.searchParams.set('q', `org:${this.classroom.org} "${this.classroom.prefix}-" in:name ${this.classroom.extraSearch || ''}`); + url.searchParams.set('q', `org:${this.classroom.org} "${this.classroom.prefix}-" in:name ${this.classroom.extraSearch ?? 'fork:true'}`); open(url); } } diff --git a/services/apps/assignments/src/classroom/classroom.service.ts b/services/apps/assignments/src/classroom/classroom.service.ts index b54116ab..451e4057 100644 --- a/services/apps/assignments/src/classroom/classroom.service.ts +++ b/services/apps/assignments/src/classroom/classroom.service.ts @@ -220,7 +220,7 @@ export class ClassroomService { private getQuery(assignment: AssignmentDocument): string { const {org, prefix, extraSearch} = assignment.classroom!; - return `org:${org} "${prefix}-" in:name ${extraSearch || ''}`; + return `org:${org} "${prefix}-" in:name ${extraSearch || 'fork:true'}`; } private async getRepoZip(assignment: AssignmentDocument, github: string, commit: string): Promise {