Skip to content

Commit e10321b

Browse files
authored
Merge pull request #1 from SysSn13/users
Feat: Rating prediction algorithm
2 parents 6d070ee + 60dd61b commit e10321b

File tree

8 files changed

+336
-2202
lines changed

8 files changed

+336
-2202
lines changed

models/contest.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const mongoose = require('mongoose');
2+
const Schema = mongoose.Schema
3+
4+
const ContestRankingsSchema = new Schema({
5+
_id: String,
6+
contest_id: Number,
7+
lastUpdated:{
8+
type: Date,
9+
default: Date.now()
10+
},
11+
rankings : [{
12+
_id: String,
13+
user_slug: String,
14+
country_code: String,
15+
country_name: String,
16+
data_region: {
17+
type: String,
18+
default: "US"
19+
},
20+
rank: Number,
21+
current_rating:{
22+
type: Number,
23+
default:-1
24+
},
25+
predicted_rating:{
26+
type: Number,
27+
default:-1
28+
}
29+
}]
30+
})
31+
32+
33+
module.exports = mongoose.model('Contest',ContestRankingsSchema)

models/users.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const mongoose = require("mongoose")
2+
3+
const userSchema = new mongoose.Schema({
4+
_id:{
5+
type: String
6+
},
7+
attendedContestsCount:{
8+
type: Number,
9+
default: 0
10+
},
11+
rating:{
12+
type: Number,
13+
default: 1500
14+
},
15+
globalRanking:{
16+
type: Number,
17+
default:0
18+
},
19+
lastUpdated:{
20+
type: Date,
21+
default: Date.now,
22+
},
23+
})
24+
module.exports = mongoose.model("User",userSchema)

0 commit comments

Comments
 (0)