From 55a39e00542158df524f5aa6397a8e30d9945aaa Mon Sep 17 00:00:00 2001 From: Stephan Krusche Date: Mon, 4 Nov 2024 08:39:52 +0100 Subject: [PATCH 1/2] Development: Bump version to 7.7.0 --- README.md | 2 +- build.gradle | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9b8299f8b7f7..b8f525065427 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ Refer to [Using JHipster in production](http://www.jhipster.tech/production) for The following command can automate the deployment to a server. The example shows the deployment to the main Artemis test server (which runs a virtual machine): ```shell -./artemis-server-cli deploy username@artemistest.ase.in.tum.de -w build/libs/Artemis-7.6.5.war +./artemis-server-cli deploy username@artemistest.ase.in.tum.de -w build/libs/Artemis-7.7.0.war ``` ## Architecture diff --git a/build.gradle b/build.gradle index 347d18815d92..2155106c1695 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ plugins { } group = "de.tum.cit.aet.artemis" -version = "7.6.5" +version = "7.7.0" description = "Interactive Learning with Individual Feedback" java { diff --git a/package-lock.json b/package-lock.json index c7490d23feed..375b835ba7bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "artemis", - "version": "7.6.5", + "version": "7.7.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "artemis", - "version": "7.6.5", + "version": "7.7.0", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index e70a9be00b03..2b3b73c8e016 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "artemis", - "version": "7.6.5", + "version": "7.7.0", "description": "Interactive Learning with Individual Feedback", "private": true, "license": "MIT", From fdc2501b5cb51c4664153ba562c751caec9ee144 Mon Sep 17 00:00:00 2001 From: Enea Gore <73840596+EneaGore@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:03:25 +0100 Subject: [PATCH 2/2] Development: Fix load rating api spam and fix flaky e2e tests (#9665) --- .../exercises/shared/rating/rating.component.ts | 4 +++- .../spec/component/rating/rating.component.spec.ts | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/app/exercises/shared/rating/rating.component.ts b/src/main/webapp/app/exercises/shared/rating/rating.component.ts index 41173d0c219f..918caf3876d3 100644 --- a/src/main/webapp/app/exercises/shared/rating/rating.component.ts +++ b/src/main/webapp/app/exercises/shared/rating/rating.component.ts @@ -15,6 +15,7 @@ export class RatingComponent implements OnInit, OnChanges { public rating: number; public disableRating = false; @Input() result?: Result; + private previousResultId?: number; constructor( private ratingService: RatingService, @@ -26,7 +27,8 @@ export class RatingComponent implements OnInit, OnChanges { } ngOnChanges(changes: SimpleChanges): void { - if (changes['result'] && !changes['result'].isFirstChange()) { + if (changes['result'] && changes['result'].currentValue?.id !== this.previousResultId) { + this.previousResultId = changes['result'].currentValue?.id; this.loadRating(); } } diff --git a/src/test/javascript/spec/component/rating/rating.component.spec.ts b/src/test/javascript/spec/component/rating/rating.component.spec.ts index 87f4018ec8a9..cab6a9d11e14 100644 --- a/src/test/javascript/spec/component/rating/rating.component.spec.ts +++ b/src/test/javascript/spec/component/rating/rating.component.spec.ts @@ -98,6 +98,20 @@ describe('RatingComponent', () => { expect(ratingComponent.rating).toBe(2); }); + it('should not call loadRating if result ID remains the same', () => { + // without this condition the loadRating might be spammed making unnecessary api calls + const loadRatingSpy = jest.spyOn(ratingComponent, 'loadRating'); + ratingComponent.result = { id: 90 } as Result; + ratingComponent.result.submission = { id: 1 } as Submission; + ratingComponent.result.participation = { id: 1 } as Participation; + jest.spyOn(ratingService, 'getRating').mockReturnValue(of(2)); + ratingComponentFixture.detectChanges(); + ratingComponent.result = { id: 90 } as Result; + ratingComponentFixture.detectChanges(); + expect(loadRatingSpy).toHaveBeenCalledOnce(); + expect(ratingComponent.rating).toBe(2); + }); + describe('OnRate', () => { beforeEach(() => { ratingComponent.rating = 0;