Skip to content

Commit 519c0cd

Browse files
committed
Added working Ranking code
2 parents dfe8fb4 + 919467b commit 519c0cd

58 files changed

Lines changed: 639 additions & 150 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

codecamp-front/.angular-cli.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@
2323
"styles.css"
2424
],
2525
"scripts": [
26-
2726
"../node_modules/popper.js/dist/umd/popper.min.js",
2827
"../node_modules/jquery/dist/jquery.min.js",
2928
"../node_modules/bootstrap/dist/js/bootstrap.min.js",
3029
"../node_modules/ace-builds/src-min/ace.js",
31-
"../node_modules/ace-builds/src-min/mode-c_cpp.js",
30+
"../node_modules/ace-builds/src-min/theme-sqlserver.js",
31+
"../node_modules/ace-builds/src-min/mode-c.js",
32+
"../node_modules/ace-builds/src-min/mode-cpp.js",
3233
"../node_modules/ace-builds/src-min/mode-python.js",
3334
"../node_modules/ace-builds/src-min/mode-java.js"
3435
],

codecamp-front/package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codecamp-front/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"core-js": "^2.4.1",
2929
"jquery": "^3.3.1",
3030
"ng2-ace-editor": "^0.3.4",
31+
"ng2-file-upload": "^1.3.0",
3132
"popper.js": "^1.12.9",
3233
"rxjs": "^5.5.6",
3334
"zone.js": "^0.8.19"

codecamp-front/src/app/app-routing.module.ts

Lines changed: 72 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,81 @@ import { EditContestComponent } from './components/edit-contest/edit-contest.com
1919
import { ProblemComponent } from './components/problem/problem.component';
2020
import { AddProblemComponent } from './components/add-problem/add-problem.component';
2121

22+
import { AuthGuard } from './guards/auth.guard';
23+
import { NotAuthGuard } from './guards/not-auth.guard';
24+
import { SolultionSubmitComponent } from './components/solultion-submit/solultion-submit.component';
25+
import { SolutionComponent } from './components/solultion-submit/solution/solution.component';
2226

2327

2428
const appRoutes: Routes = [
25-
{path: '', component: HomeComponent },
26-
{path: 'about', component: AboutComponent},
27-
{path: 'register' , component: RegisterComponent},
28-
{path: 'login' , component: LoginComponent},
29-
{path: 'practice' , component: PracticeComponent},
30-
{path: 'contest' , component: ContestComponent},
31-
{path: 'discuss' , component: DiscussComponent},
32-
{path: 'profile' , component: ProfileComponent},
33-
{path: 'ide', component: IdeComponent},
34-
{path: 'contest/add-contest', component: AddContestComponent},
35-
{path: 'contest/:contest', component: ProblemsComponent},
36-
{path: 'contest/:contest/addproblem', component: AddProblemComponent},
37-
{path: 'contest/:contest/:problem', component: ProblemComponent},
38-
{path: 'contest/edit/:edit-contest', component: EditContestComponent},
29+
{
30+
path: '',
31+
component: HomeComponent
32+
},
33+
{
34+
path: 'about',
35+
component: AboutComponent
36+
},
37+
{
38+
path: 'register',
39+
component: RegisterComponent
40+
},
41+
{
42+
path: 'login',
43+
component: LoginComponent
44+
},
45+
{
46+
path: 'practice',
47+
component: PracticeComponent
48+
},
49+
{
50+
path: 'contest',
51+
component: ContestComponent
52+
},
53+
{
54+
path: 'discuss',
55+
component: DiscussComponent
56+
},
57+
{
58+
path: 'profile',
59+
component: ProfileComponent,
60+
canActivate: [AuthGuard]
61+
},
62+
{
63+
path: 'ide',
64+
component: IdeComponent
65+
},
66+
{
67+
path: ':contest/submit/:code',
68+
component: SolultionSubmitComponent
69+
},
70+
{
71+
path: 'submit/complete',
72+
component: SolutionComponent
73+
},
74+
{
75+
path: 'contest/add-contest',
76+
component: AddContestComponent,
77+
canActivate: [AuthGuard]
78+
},
79+
{
80+
path: 'contest/:contest',
81+
component: ProblemsComponent
82+
},
83+
{
84+
path: 'contest/:contest/addproblem',
85+
component: AddProblemComponent,
86+
canActivate: [AuthGuard]
87+
},
88+
{
89+
path: 'contest/:contest/:problem',
90+
component: ProblemComponent
91+
},
92+
{
93+
path: 'contest/edit/:edit-contest',
94+
component: EditContestComponent,
95+
canActivate: [AuthGuard]
96+
}
3997
];
4098

4199
@NgModule({
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
<app-navbar></app-navbar>
2-
<div class="container">
3-
<router-outlet></router-outlet>
4-
</div>
2+
<router-outlet></router-outlet>

codecamp-front/src/app/app.module.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ import { AddContestComponent } from './components/add-contest/add-contest.compon
2626
import { EditContestComponent } from './components/edit-contest/edit-contest.component';
2727
import { SubmissionComponent } from './components/submission/submission.component';
2828
import { RanklistComponent } from './components/ranklist/ranklist.component';
29-
import { SolutionComponent } from './components/solution/solution.component';
29+
import { SolutionComponent } from './components/solultion-submit/solution/solution.component';
3030
import { ProblemComponent } from './components/problem/problem.component';
3131
import { AddProblemComponent } from './components/add-problem/add-problem.component';
3232

33+
import { AuthGuard } from './guards/auth.guard';
34+
import { NotAuthGuard } from './guards/not-auth.guard';
35+
import { SolultionSubmitComponent } from './components/solultion-submit/solultion-submit.component';
3336

3437
@NgModule({
3538
declarations: [
@@ -51,7 +54,8 @@ import { AddProblemComponent } from './components/add-problem/add-problem.compon
5154
RanklistComponent,
5255
SolutionComponent,
5356
ProblemComponent,
54-
AddProblemComponent
57+
AddProblemComponent,
58+
SolultionSubmitComponent
5559
],
5660
imports: [
5761
BrowserModule,
@@ -60,7 +64,7 @@ import { AddProblemComponent } from './components/add-problem/add-problem.compon
6064
AppRoutingModule,
6165
AceEditorModule
6266
],
63-
providers: [ AuthService, ContestService],
67+
providers: [ AuthService, AuthGuard, NotAuthGuard, ContestService],
6468
bootstrap: [AppComponent]
6569
})
6670
export class AppModule { }

codecamp-front/src/app/components/add-problem/add-problem.component.html

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,32 @@
143143
<div class="row">
144144
<div class="col-md-6">
145145
<div class="form-group">
146-
<label class="file-input">Input File
147-
<input type="file" class="form-control-file">
148-
</label>
149-
</div>
150-
</div>
151-
<div class="col-md-6">
146+
<label for="Input TestCase">Input File</label>
147+
<textarea
148+
name="Input"
149+
formControlName="Input"
150+
class="form-control"
151+
placeholder="Input TestCase"
152+
autocomplete="off"
153+
[ngClass]="{'is-invalid': (form.controls.Input.errors && form.controls.Input.dirty) , 'is-valid': !form.controls.Input.errors}">
154+
</textarea>
155+
</div>
156+
</div>
157+
<div class="col-md-6">
152158
<div class="form-group">
153-
<label class="file-output">Output File
154-
<input type="file" class="form-control-file">
155-
</label>
156-
</div>
157-
158-
</div>
159+
<label for="output_example">Output File</label>
160+
<textarea
161+
name="Output"
162+
formControlName="Output"
163+
class="form-control"
164+
placeholder="Output Test case"
165+
autocomplete="off"
166+
[ngClass]="{'is-invalid': (form.controls.Output.errors && form.controls.Output.dirty) , 'is-valid': !form.controls.Output.errors}">
167+
</textarea>
168+
</div>
169+
</div>
159170
</div>
171+
160172
<div class="form-group">
161173
<label for="Explanation Example">Explanation Example</label>
162174
<textarea
@@ -167,7 +179,7 @@
167179
</div>
168180

169181
<input
170-
[disabled]="!form.valid"
182+
171183
type="submit" class="btn btn-primary" value="Add Problem">
172184
</form>
173185
</div>

codecamp-front/src/app/components/add-problem/add-problem.component.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ export class AddProblemComponent implements OnInit {
2626
this.form = this.formBuilder.group({
2727
code: ['', Validators.required],
2828
name: ['', Validators.required],
29-
level: [''],
30-
description: [''],
31-
input_format: [''],
32-
output_format: [''],
33-
constraints: [''],
34-
input_example: [''],
35-
output_example: [''],
36-
explanation_example: [''],
37-
timelimit: [''],
38-
sourcelimit: [''],
39-
author: [''],
40-
Input: [''],
41-
Output: ['']
29+
level: ['', Validators.required],
30+
description: ['', Validators.required],
31+
input_format: ['', Validators.required],
32+
output_format: ['', Validators.required],
33+
constraints: ['', Validators.required],
34+
input_example: ['', Validators.required],
35+
output_example: ['', Validators.required],
36+
explanation_example: ['', Validators.required],
37+
timelimit: ['', Validators.required],
38+
sourcelimit: ['', Validators.required],
39+
author: ['', Validators.required],
40+
Input: ['', Validators.required],
41+
Output: ['', Validators.required]
4242
});
4343
}
4444

@@ -57,8 +57,8 @@ export class AddProblemComponent implements OnInit {
5757
timelimit: this.form.get('timelimit').value,
5858
sourcelimit: this.form.get('sourcelimit').value,
5959
author: this.form.get('author').value,
60-
Input: this.form.get('Input').value,
61-
Output: this.form.get('Output').value,
60+
testCaseInput: this.form.get('Input').value,
61+
testCaseOutput: this.form.get('Output').value
6262
};
6363

6464
this.contestService.addProblem(problem, this.contest).subscribe(data => {

codecamp-front/src/app/components/contest/contest.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
22
import { AuthService } from '../../services/auth.service';
33
import { Router } from '@angular/router';
44
import { ContestService } from '../../services/contest.service';
5+
import { Subject } from 'rxjs/Subject';
6+
import { Observable } from 'rxjs/Observable';
57

68
@Component({
79
selector: 'app-contest',
@@ -10,7 +12,6 @@ import { ContestService } from '../../services/contest.service';
1012
})
1113
export class ContestComponent implements OnInit {
1214
contest;
13-
1415
constructor(
1516
public authService: AuthService,
1617
private router: Router,
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.page-header {
2+
height: 90vh;
3+
overflow: hidden;
4+
}
5+
.header-filter {
6+
position: relative;
7+
}
8+
9+
.page-header {
10+
height: 100vh;
11+
background-position: 50%;
12+
background-size: cover;
13+
margin: 0;
14+
padding: 0;
15+
border: 0;
16+
display: flex;
17+
align-items: center;
18+
opacity: 0.85;
19+
20+
}
21+
22+
23+
.header-filter:after {
24+
position: absolute;
25+
z-index: 1;
26+
width: 100%;
27+
height: 100%;
28+
display: block;
29+
left: 0;
30+
top: 0;
31+
content: "";
32+
}
33+
34+
.brand {
35+
color: #fff;
36+
text-align: center;
37+
}
38+
39+
.brand h3 {
40+
font-size: 1.313rem;
41+
max-width: 500px;
42+
margin: 10px auto 0;
43+
}

0 commit comments

Comments
 (0)