|
|
@ -13,8 +13,7 @@ import { User } from '../models/user.model';
|
|
|
|
let subs: Submission[] = [];
|
|
|
|
let subs: Submission[] = [];
|
|
|
|
let UserID: number = 0;
|
|
|
|
let UserID: number = 0;
|
|
|
|
|
|
|
|
|
|
|
|
export async function loadPage(renderer: Renderer2, el: ElementRef, ts: any): Promise<void> {
|
|
|
|
export async function loadPage(renderer: Renderer2, el: ElementRef, ts: any, prac: Boolean): Promise<void> {
|
|
|
|
const isPractice = window.location.href.includes("Prac");
|
|
|
|
|
|
|
|
const taskbar: HTMLElement = document.getElementById('Taskbar')!;
|
|
|
|
const taskbar: HTMLElement = document.getElementById('Taskbar')!;
|
|
|
|
|
|
|
|
|
|
|
|
// basics for use in multiple methods
|
|
|
|
// basics for use in multiple methods
|
|
|
@ -27,7 +26,7 @@ export async function loadPage(renderer: Renderer2, el: ElementRef, ts: any): Pr
|
|
|
|
hintDesc: el.nativeElement.querySelector('#Hint_Desc') as HTMLElement,
|
|
|
|
hintDesc: el.nativeElement.querySelector('#Hint_Desc') as HTMLElement,
|
|
|
|
HintButts: el.nativeElement.querySelector('#Hint_Butts') as HTMLElement
|
|
|
|
HintButts: el.nativeElement.querySelector('#Hint_Butts') as HTMLElement
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await LoadContest(el, elements, ts);
|
|
|
|
await LoadContest(el, elements, ts, prac);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// get the params to see if admin or not
|
|
|
|
// get the params to see if admin or not
|
|
|
@ -53,12 +52,14 @@ async function getUser() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// load the current active contest
|
|
|
|
// load the current active contest
|
|
|
|
async function LoadContest(el: ElementRef, elements: any, ts: any) {
|
|
|
|
async function LoadContest(el: ElementRef, elements: any, ts: any, prac: Boolean) {
|
|
|
|
const contestID = new URLSearchParams(window.location.search).get('contestID');
|
|
|
|
const contestID = new URLSearchParams(window.location.search).get('contestID');
|
|
|
|
console.log("Contest ID:", contestID);
|
|
|
|
|
|
|
|
let contest: Contest | undefined;
|
|
|
|
let contest: Contest | undefined;
|
|
|
|
if(contestID){
|
|
|
|
if(prac === true){
|
|
|
|
const data = { contestID: contestID};
|
|
|
|
const selectedContestStr = sessionStorage.getItem('contestID');
|
|
|
|
|
|
|
|
const selectedContest = selectedContestStr ? parseInt(selectedContestStr, 10) : null;
|
|
|
|
|
|
|
|
console.log("Contest ID:", selectedContest);
|
|
|
|
|
|
|
|
const data = { contestID: selectedContest};
|
|
|
|
const res = await fetch('api/contests/getContestByID', {
|
|
|
|
const res = await fetch('api/contests/getContestByID', {
|
|
|
|
method: 'POST',
|
|
|
|
method: 'POST',
|
|
|
|
headers: {
|
|
|
|
headers: {
|
|
|
|