Skip to content

Commit bacb48e

Browse files
committed
all done!!!!!!
1 parent 9ed2eb2 commit bacb48e

File tree

7 files changed

+19
-14
lines changed

7 files changed

+19
-14
lines changed

backend/Archive.zip

-7.1 KB
Binary file not shown.

backend/app.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ const app = express();
99

1010
mongoose
1111
.connect(
12-
// "mongodb://localhost:27017/myapp"
13-
"mongodb://ladder:YnwLdH8guBV9EOam@cluster0-shard-00-00-cvuiq.mongodb.net:27017,cluster0-shard-00-01-cvuiq.mongodb.net:27017,cluster0-shard-00-02-cvuiq.mongodb.net:27017/myLadder?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true&w=majority"
12+
"mongodb://localhost:27017/myapp"
13+
// "mongodb://ladder:YnwLdH8guBV9EOam@cluster0-shard-00-00-cvuiq.mongodb.net:27017,cluster0-shard-00-01-cvuiq.mongodb.net:27017,cluster0-shard-00-02-cvuiq.mongodb.net:27017/myLadder?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true&w=majority"
1414
)
1515
.then(() => {
1616
console.log("Connected to database!");
@@ -58,16 +58,16 @@ function predicateBy(prop) {
5858
// Squash Data
5959
app.get('/api/table/squash', (req, res, next) => {
6060
const squashData = [];
61-
Player.find().then(documents => {
61+
Player.find({ preferred: { $regex: "squash" } }).then(documents => {
6262
for (let i = 0; i < documents.length; i++) {
6363
squashData.push({
6464
id: documents[i]["_id"],
6565
rank: null,
6666
username: documents[i]["name"],
6767
points: documents[i]["squash_score"],
6868
category: documents[i]["category"],
69-
matchPlayed: documents[i]['match_played_squash'],
70-
matchWon: documents[i]['match_won_squash']
69+
matchPlayed: documents[i]["match_played_squash"],
70+
matchWon: documents[i]["match_won_squash"]
7171
});
7272
}
7373
squashData.sort(predicateBy("points"));
@@ -82,7 +82,7 @@ app.get('/api/table/squash', (req, res, next) => {
8282
// Table Tennis Data
8383
app.get('/api/table/tt', (req, res, next) => {
8484
const ttData = [];
85-
Player.find().then(documents => {
85+
Player.find({ preferred: { $regex: "tt" } }).then(documents => {
8686
for (let i = 0; i < documents.length; i++) {
8787
ttData.push({
8888
id: documents[i]["_id"],
@@ -106,7 +106,7 @@ app.get('/api/table/tt', (req, res, next) => {
106106
// Lawn Tennis Data
107107
app.get('/api/table/tennis', (req, res, next) => {
108108
const tennisData = [];
109-
Player.find().then(documents => {
109+
Player.find({ preferred: { $regex: "tennis" } }).then(documents => {
110110
for (let i = 0; i < documents.length; i++) {
111111
tennisData.push({
112112
id: documents[i]["_id"],
@@ -131,7 +131,7 @@ app.get('/api/table/tennis', (req, res, next) => {
131131
app.get('/api/table/badminton', (req, res, next) => {
132132

133133
const badmintonData = [];
134-
Player.find().then(documents => {
134+
Player.find({ preferred: { $regex: "badminton" } }).then(documents => {
135135
for (let i = 0; i < documents.length; i++) {
136136
badmintonData.push({
137137
id: documents[i]["_id"],
@@ -713,7 +713,7 @@ app.post("/api/login", (req, res, next) => {
713713
}
714714
const token = jwt.sign(
715715
{ roll: fetchedPlayer.roll, playerId: fetchedPlayer._id },
716-
process.env.JWT_KEY
716+
'harsh_is_god_he_is_invincible'
717717
);
718718
res.status(200).json({
719719
token: token,

src/app/auth/signup/signup.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</mat-form-field>
4343
<mat-form-field>
4444
<mat-label>Preferred Sport</mat-label>
45-
<mat-select name="preferred" [(ngModel)]="preferred" required>
45+
<mat-select name="preferred" [(ngModel)]="preferred" required multiple>
4646
<mat-option value="squash">Squash</mat-option>
4747
<mat-option value="tt">Table Tennis</mat-option>
4848
<mat-option value="tennis">Lawn Tennis</mat-option>

src/app/auth/signup/signup.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ export class SignupComponent {
2020
constructor(public authService: AuthService) {}
2121

2222
onSignup(form: NgForm) {
23+
console.log(this.preferred);
24+
let sports = '';
25+
for (const sport of this.preferred) {
26+
sports = sports + sport;
27+
}
2328
if (form.invalid) {
2429
return;
2530
}
@@ -29,7 +34,7 @@ export class SignupComponent {
2934
form.value.hostel,
3035
form.value.gender,
3136
form.value.category,
32-
form.value.preferred,
37+
sports,
3338
form.value.contact,
3439
form.value.password
3540
);

src/app/confirmation/update-result/updateResult.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ <h1 style="margin-left: 20%;">Update Result</h1>
1818
<h2>How to enter score?</h2>
1919
</div>
2020
<p>Enter the match score in first one <br>
21-
Enter set score like <br> 11-0; 11-10; 11-9 </p>
21+
Enter set score like this<br> 11-0 11-10 11-9 </p>
2222
</mat-card>

src/environments/environment.prod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export const environment = {
22
production: true,
3-
apiUrl: 'http://ladderranking-env.qmh2e8famw.us-east-2.elasticbeanstalk.com/api/'
3+
apiUrl: 'http://13.232.113.230/api/'
44
};

src/environments/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
export const environment = {
66
production: false,
7-
apiUrl: 'http://ladderranking-env.qmh2e8famw.us-east-2.elasticbeanstalk.com/api/'
7+
apiUrl: 'http://13.232.113.230/api/'
88
};
99

1010
/*

0 commit comments

Comments
 (0)