Skip to content

Commit

Permalink
v3.19.5 (#188)
Browse files Browse the repository at this point in the history
* Add validation to game editor.

* Don't serve host API key in external host responses.

* Initial work on game center

* Finish batch user create

* Add observe links to support tickets. Fix enroll bugs (Admin enroll and loading indicator on error)

* Allow VM console urls to be built without a name, since they get a default one now.

* Add work for 3.19.3

* Fix decimal precision for questionw eight

* Fixed an issue that prevented the challenge observe link in Support Tools from working. Observe links now only appears when the session is live.

* Allow game end to be nullish. Show ongoing games on the landing.
  • Loading branch information
sei-bstein authored Jun 13, 2024
1 parent 6f81311 commit 250c731
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ <h4>Execution</h4>

</div>

<div *ngIf="game.gameStart > game.gameEnd" class="row form-group">
<div *ngIf="executionRangeInvalid" class="row form-group">
<alert type="warning" class="col-12">The game's open date must be less than its close date.</alert>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class GameEditorComponent implements AfterViewInit, OnChanges {
viewing = 1;
showCertificateInfo = false;
showExternalGameFields = false;
protected executionRangeInvalid = false;
protected specCount = 0;

// store unique values of each game field with their frequencies for ordered suggestion lists
Expand Down Expand Up @@ -184,8 +185,16 @@ export class GameEditorComponent implements AfterViewInit, OnChanges {
if (game.minTeamSize > game.maxTeamSize)
return false;

if (game.gameStart > game.gameEnd)
this.executionRangeInvalid = false;
const gameStart = game.gameStart ? new Date(game.gameStart) : new Date(0);
const gameEnd = game.gameEnd ? new Date(game.gameEnd) : new Date(0);
if (gameStart.getFullYear() > 1 && gameEnd?.getFullYear() > 1 && game.gameStart > game.gameEnd) {
this.executionRangeInvalid = true;
return false;
}

game.gameStart = gameStart;
game.gameEnd = gameEnd;

if (game.registrationType == GameRegistrationType.open && game.registrationOpen > game.registrationClose)
return false;
Expand Down
18 changes: 18 additions & 0 deletions projects/gameboard-ui/src/app/home/landing/landing.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ <h2>Featured Games</h2>
</ng-container>
</div>

<!-- Ongoing (games with no end date) -->
<div class="row mt-1" *ngIf="ongoing$ | async as ongoing; else loadingOngoing">
<ng-container *ngIf="!!ongoing.length">
<div class="col-12 mx-0 px-0 mb-2">
<h2>Ongoing Games</h2>
</div>
<ng-container *ngFor="let game of ongoing">
<ng-container *ngTemplateOutlet="gameWrapper;context: {game: game}"></ng-container>
</ng-container>
</ng-container>
</div>

<!-- Live -->
<div class="row mt-1" *ngIf="present$ | async as present; else loading">
<ng-container *ngIf="!!present.length">
Expand Down Expand Up @@ -113,6 +125,12 @@ <h2 class="p-0 m-0 font-weight-bold">Open Game</h2>
</div>
</ng-template>

<ng-template #loadingOngoing>
<div class="text-center">
<app-spinner>Loading ongoing games...</app-spinner>
</div>
</ng-template>

<ng-template #loading>
<div class="text-center">
<app-spinner>Loading games...</app-spinner>
Expand Down
19 changes: 12 additions & 7 deletions projects/gameboard-ui/src/app/home/landing/landing.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { GameService } from '../../api/game.service';
export class LandingComponent implements OnInit {
refresh$ = new BehaviorSubject<any>(true);
featured$: Observable<Game[]>;
ongoing$: Observable<Game[]>;
past$: Observable<GameGroup[]>;
present$: Observable<Game[]>;
future$: Observable<GameGroup[]>;
Expand All @@ -38,22 +39,26 @@ export class LandingComponent implements OnInit {
) {
this.featured$ = this.refresh$.pipe(
debounceTime(400),
switchMap(() => api.list({ isFeatured: true, filter: [], term: this.searchText })),
switchMap(() => api.list({ isFeatured: true, term: this.searchText })),
tap(g => { if (g.length > 0) { this.showSearchBar = true; } }),
);
this.past$ = this.refresh$.pipe(
this.ongoing$ = this.refresh$.pipe(
debounceTime(400),
switchMap(() => api.listGrouped({ filter: ['past', "competitive"], term: this.searchText })),
tap(g => { if (g.length > 0) { this.showSearchBar = true; } }),
);
switchMap(() => api.list({ isOngoing: true, term: this.searchText }))
),
this.past$ = this.refresh$.pipe(
debounceTime(400),
switchMap(() => api.listGrouped({ filter: ['past', "competitive"], isOngoing: false, term: this.searchText })),
tap(g => { if (g.length > 0) { this.showSearchBar = true; } }),
);
this.present$ = this.refresh$.pipe(
debounceTime(200),
switchMap(() => api.list({ filter: ["present", "competitive"], term: this.searchText })),
switchMap(() => api.list({ filter: ["present", "competitive"], isOngoing: false, term: this.searchText })),
tap(g => { if (g.length > 0) { this.showSearchBar = true; } })
);
this.future$ = this.refresh$.pipe(
debounceTime(300),
switchMap(() => api.listGrouped({ filter: ['future', "competitive"], term: this.searchText })),
switchMap(() => api.listGrouped({ filter: ['future', "competitive"], isOngoing: false, term: this.searchText })),
tap(g => { if (g.length > 0) { this.showSearchBar = true; } })
);
}
Expand Down

0 comments on commit 250c731

Please sign in to comment.