Skip to content

Commit 9786362

Browse files
committed
timer and auth work for problem
2 parents 9d4746a + 997d61e commit 9786362

15 files changed

Lines changed: 1108 additions & 21 deletions

File tree

codecamp-front/package-lock.json

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

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import { NgProgressModule, NgProgressBrowserXhr } from 'ngx-progressbar';
4141
import { BrowserXhr } from '@angular/http';
4242
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
4343
import { FlashMessagesModule } from 'angular2-flash-messages';
44-
44+
//import { CountDown } from 'ng2-date-countdown';
4545

4646
@NgModule({
4747
declarations: [
@@ -67,7 +67,8 @@ import { FlashMessagesModule } from 'angular2-flash-messages';
6767
SolultionSubmitComponent,
6868
PreloaderComponent,
6969
SidebarComponent,
70-
EditProfileComponent
70+
EditProfileComponent,
71+
//CountDown
7172
],
7273
imports: [
7374
BrowserModule,

codecamp-front/src/app/services/auth.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ export class AuthService {
3434
this.authToken = localStorage.getItem('token'); // Get tokens and asssign to variable to be used elsewhere
3535
}
3636
public registerUser(user) {
37-
return this.http.post(this.domain + 'users/signup', user)
37+
return this.http.post('users/signup', user)
3838
.map(res => res.json());
3939
}
4040

4141
public loginUser(user) {
42-
return this.http.post(this.domain + 'users/signin', user)
42+
return this.http.post('users/signin', user)
4343
.map(res => res.json());
4444
}
4545

@@ -63,7 +63,7 @@ export class AuthService {
6363
}
6464

6565
public getUsername() {
66-
const user = JSON.parse(localStorage.getItem('user'));
66+
const user = JSON.parse(localStorage.getItem('user'));
6767
return user;
6868
}
6969

@@ -78,6 +78,6 @@ export class AuthService {
7878
}
7979
getProfile() {
8080
this.createAuthenticationHeaders();
81-
return this.http.get(this.domain + 'users/profile', this.options).map(res => res.json());
81+
return this.http.get('users/profile', this.options).map(res => res.json());
8282
}
8383
}

codecamp-front/src/app/services/contest.service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ export class ContestService {
1515
public authToken: any;
1616
public user: any;
1717
public contest: any;
18-
public domain = 'http://localhost:80/';
18+
public domain = 'http://localhost:80/';
1919
public options;
2020
public sol;
2121
public toggler: boolean;
2222

2323

2424

25-
private contestSource = new BehaviorSubject<string>(' default contest ');
25+
private contestSource = new BehaviorSubject<string>('default contest');
2626
currentContest = this.contestSource.asObservable();
2727

2828
private Toggler = new BehaviorSubject<boolean>(true);
@@ -60,12 +60,12 @@ export class ContestService {
6060
}
6161

6262
public addProblem(problem, contest): Observable<any> {
63-
return this.http.post(this.domain + 'contest/' + contest, problem)
63+
return this.http.post('contest/' + contest, problem)
6464
.map(res => res.json());
6565
}
6666

6767
public getProblems(contest): Observable<any> {
68-
return this.http.get( this.domain + 'contest/' + contest)
68+
return this.http.get( 'contest/' + contest)
6969
.map(res => res.json());
7070
}
7171

@@ -75,7 +75,7 @@ export class ContestService {
7575
}
7676

7777
public addSolution(solution): Observable<any> {
78-
return this.http.post(this.domain + 'solution', solution)
78+
return this.http.post('solution', solution)
7979
.map(res => res.json());
8080
}
8181
public deleteContest(contest) {
@@ -94,7 +94,7 @@ export class ContestService {
9494
}
9595

9696
getRankings(contest) {
97-
return this.http.get(this.domain + 'rankings/' + contest)
97+
return this.http.get('rankings/' + contest)
9898
.map(res => res.json());
9999
}
100100
ontoggle(value: boolean) {

contest/models/problem/problem.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ const ProblemSchema = new mongoose.Schema({
5757
type:mongoose.Schema.Types.String,
5858
refs:'User'
5959
}],
60+
image:{
61+
type:String
62+
},
6063
author:{
6164
type:String
6265
},

judge/compileProblem.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const compileProblem= async (lang , filename)=>{
1212
switch(lang){
1313
case "c":
1414
file = path.basename(filename,'.c') +".out ";
15-
cmd="cd "+"\"" + path.join(__dirname,"result/source") +"\"" + " && gcc -o \"" +path.join(__dirname,"result/binary/") + "\""+file +" "+ filename;
15+
cmd="cd "+"\"" + path.join(__dirname,"result/source") +"\"" + " && gcc -o \"" +path.join(__dirname,"result/binary/") + "\""+file +" "+ filename+" -lm";
1616
break
1717
case "c++":
1818
case "cpp":
@@ -26,7 +26,7 @@ const compileProblem= async (lang , filename)=>{
2626
return new Promise((resolve,reject)=>{
2727
exec(cmd, (error, stdout, stderr) => {
2828
if (error) {
29-
//console.error(`${error}`);
29+
console.error(`${error}`);
3030
reject(error);
3131
}
3232
resolve(file)

judge/result/binary/Solution.class

816 Bytes
Binary file not shown.

judge/result/binary/Solution.out

-4.63 KB
Binary file not shown.

judge/result/source/Solution.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
<<<<<<< HEAD
2+
#include <stdio.h>
3+
#include <string.h>
4+
int main()
5+
{
6+
char S[100002];
7+
long int T;
8+
int i,t1,t2,l;
9+
scanf("%ld",&T);
10+
while(T)
11+
{
12+
T--;
13+
t1=t2=0;
14+
scanf("%s",S);
15+
l=strlen(S);
16+
for(i=0;i<l;i++){
17+
if(S[i]=='a'|| S[i]=='e'||S[i]=='i'||S[i]=='o'||S[i]=='u'||S[i]=='A'||S[i]=='E'||S[i]=='I'||S[i]=='O'||S[i]=='U')
18+
t1++;
19+
else t2++;
20+
}
21+
if(t1>=t2)
22+
printf("GOOD\n");
23+
else
24+
printf("BAD\n");
25+
}
26+
return 0;
27+
}
28+
=======
129
import java.util.*;
230
import java.lang.Math;
331
class ordteams
@@ -88,4 +116,5 @@ class ordteams
88116

89117
}
90118
}
91-
}
119+
}
120+
>>>>>>> 6b9a84523259144e34994839aeeb1470ef83ebe7

judge/result/source/Solution.cpp

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1+
<<<<<<< HEAD
2+
#include<bits/stdc++.h>
3+
#define pb push_back
4+
#define ll long long
5+
#define d double
6+
using namespace std;
7+
int main()
8+
{
9+
ll t,i,a;
10+
cin>>t;
11+
while(t--)
12+
{
13+
ll c=0,index=0;
14+
vector<ll>v;
15+
ll n;
16+
cin>>n;
17+
for(i=0;i<n;i++)
18+
{
19+
cin>>a;
20+
v.pb(a);
21+
}
22+
ll z=1;
23+
for(i=1;i<n;i++)
24+
{
25+
if(v[i]!=v[0])
26+
{
27+
index=i;
28+
break;
29+
}
30+
else
31+
{
32+
z++;
33+
}
34+
}
35+
for(i=index;i<n;i++)
36+
{
37+
if(v[i]!=v[0] || v[i]!=v[i-1])
38+
{
39+
c++;
40+
}
41+
}
42+
if(z==n)
43+
{
44+
c=0;
45+
cout<<c<<endl;
46+
}
47+
else
48+
{
49+
cout<<c<<endl;
50+
}
51+
}
52+
return 0;
53+
}
54+
=======
155
#include <iostream>
256
using namespace std;
357

@@ -43,3 +97,4 @@ int main() {
4397
}
4498
return 0;
4599
}
100+
>>>>>>> 6b9a84523259144e34994839aeeb1470ef83ebe7

0 commit comments

Comments
 (0)