mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-24 23:19:39 -05:00
mongoose maplist schema expansion
This commit is contained in:
parent
4d7ca7fb7f
commit
2beef1d01d
38
frontend-react/package-lock.json
generated
38
frontend-react/package-lock.json
generated
|
|
@ -13593,9 +13593,9 @@
|
|||
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
|
||||
},
|
||||
"source-map-explorer": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map-explorer/-/source-map-explorer-2.3.1.tgz",
|
||||
"integrity": "sha512-l3WQUCwaqia5x7EBnNp4GYwhXnROMz3NqKM2QMwQ3ADgjekp+enP+PHkjjbjoVX6WJ2G5mbvM6TjeE/q7fnIFw==",
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/source-map-explorer/-/source-map-explorer-2.4.0.tgz",
|
||||
"integrity": "sha512-gXTmqqMlX1yF9uVZB2p9AvIhgArWvy7V+3NQ2lVgQvyux1eMAgnm3mC+k5mqV+2q7B/uWaFY+RG+fm+1opVkjA==",
|
||||
"requires": {
|
||||
"btoa": "^1.2.1",
|
||||
"chalk": "^3.0.0",
|
||||
|
|
@ -13605,10 +13605,10 @@
|
|||
"glob": "^7.1.6",
|
||||
"gzip-size": "^5.1.1",
|
||||
"lodash": "^4.17.15",
|
||||
"open": "^7.0.2",
|
||||
"open": "^7.0.3",
|
||||
"source-map": "^0.7.3",
|
||||
"temp": "^0.9.1",
|
||||
"yargs": "^15.1.0"
|
||||
"yargs": "^15.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-styles": {
|
||||
|
|
@ -13666,6 +13666,11 @@
|
|||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
|
||||
},
|
||||
"is-wsl": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.1.1.tgz",
|
||||
"integrity": "sha512-umZHcSrwlDHo2TGMXv0DZ8dIUGunZ2Iv68YZnrmCiBPkZ4aaOhtv7pXJKeki9k3qJ3RJr0cDyitcl5wEH3AYog=="
|
||||
},
|
||||
"locate-path": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
||||
|
|
@ -13674,6 +13679,15 @@
|
|||
"p-locate": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"open": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/open/-/open-7.0.3.tgz",
|
||||
"integrity": "sha512-sP2ru2v0P290WFfv49Ap8MF6PkzGNnGlAwHweB4WR4mr5d2d0woiCluUeJ218w7/+PmoBy9JmYgD5A4mLcWOFA==",
|
||||
"requires": {
|
||||
"is-docker": "^2.0.0",
|
||||
"is-wsl": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"p-locate": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
|
||||
|
|
@ -13719,9 +13733,9 @@
|
|||
}
|
||||
},
|
||||
"yargs": {
|
||||
"version": "15.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.1.0.tgz",
|
||||
"integrity": "sha512-T39FNN1b6hCW4SOIk1XyTOWxtXdcen0t+XYrysQmChzSipvhBO8Bj0nK1ozAasdk24dNWuMZvr4k24nz+8HHLg==",
|
||||
"version": "15.3.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz",
|
||||
"integrity": "sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==",
|
||||
"requires": {
|
||||
"cliui": "^6.0.0",
|
||||
"decamelize": "^1.2.0",
|
||||
|
|
@ -13733,13 +13747,13 @@
|
|||
"string-width": "^4.2.0",
|
||||
"which-module": "^2.0.0",
|
||||
"y18n": "^4.0.0",
|
||||
"yargs-parser": "^16.1.0"
|
||||
"yargs-parser": "^18.1.1"
|
||||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
"version": "16.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz",
|
||||
"integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==",
|
||||
"version": "18.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.1.tgz",
|
||||
"integrity": "sha512-KRHEsOM16IX7XuLnMOqImcPNbLVXMNHYAoFc3BKR8Ortl5gzDbtXvvEoGx9imk5E+X1VeNKNlcHr8B8vi+7ipA==",
|
||||
"requires": {
|
||||
"camelcase": "^5.0.0",
|
||||
"decamelize": "^1.2.0"
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
"react-select": "^3.0.8",
|
||||
"react-super-responsive-table": "^5.1.1",
|
||||
"react-tweet-embed": "^1.2.2",
|
||||
"source-map-explorer": "^2.3.1",
|
||||
"source-map-explorer": "^2.4.0",
|
||||
"typescript": "^3.8.3",
|
||||
"use-query-params": "^0.6.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -138,13 +138,6 @@ const resolvers = {
|
|||
ballot => !!ballot.discord_user.plus.membership_status
|
||||
)
|
||||
|
||||
/*type MapVoteCount {
|
||||
name: String!
|
||||
sz: [Int!]!
|
||||
tc: [Int!]!
|
||||
rm: [Int!]!
|
||||
cb: [Int!]!
|
||||
}*/
|
||||
const voter_count = validBallots.length
|
||||
const vote_counts = maps.map(stage => ({
|
||||
name: stage,
|
||||
|
|
@ -223,7 +216,6 @@ const resolvers = {
|
|||
}
|
||||
|
||||
for (const stageObj of cbMaps) {
|
||||
console.log("cbMapPool.length", cbMapPool.length)
|
||||
if (cbMapPool.length >= 8 && stageObj.score <= 0) {
|
||||
break
|
||||
}
|
||||
|
|
@ -236,42 +228,29 @@ const resolvers = {
|
|||
rmMapPool.sort((a, b) => maps.indexOf(a) - maps.indexOf(b))
|
||||
cbMapPool.sort((a, b) => maps.indexOf(a) - maps.indexOf(b))
|
||||
|
||||
console.log("szMapPool", szMapPool)
|
||||
console.log("tcMapPool", tcMapPool)
|
||||
console.log("rmMapPool", rmMapPool)
|
||||
console.log("cbMapPool", cbMapPool)
|
||||
|
||||
/*type PlusMaplistInfo {
|
||||
month: Int!
|
||||
year: Int!
|
||||
voter_count: Int!
|
||||
vote_counts: [MapVoteCount!]!
|
||||
}
|
||||
|
||||
type Maplist {
|
||||
name: String!
|
||||
sz: [String!]!
|
||||
tc: [String!]!
|
||||
rm: [String!]!
|
||||
cb: [String!]!
|
||||
plus: PlusMaplistInfo
|
||||
}*/
|
||||
const now = new Date()
|
||||
|
||||
const maplist = {
|
||||
name: `Plus Server getmonth getyear`,
|
||||
name: `Plus Server ${now.toLocaleString("default", {
|
||||
month: "long",
|
||||
})} ${now.getFullYear()}`,
|
||||
sz: szMapPool,
|
||||
tc: tcMapPool,
|
||||
rm: rmMapPool,
|
||||
cb: cbMapPool,
|
||||
order: 0,
|
||||
plus: {
|
||||
month: 1,
|
||||
year: 1999,
|
||||
month: now.getMonth() + 1,
|
||||
year: now.getFullYear(),
|
||||
voter_count,
|
||||
vote_counts,
|
||||
},
|
||||
}
|
||||
|
||||
console.log("maplist", maplist)
|
||||
await Maplist.updateMany({ order: 0 }, { order: 1 })
|
||||
await Maplist.create(maplist)
|
||||
|
||||
return true
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,26 @@
|
|||
const mongoose = require('mongoose')
|
||||
const mongoose = require("mongoose")
|
||||
|
||||
const maplistSchema = new mongoose.Schema({
|
||||
name: {type: String, required: true},
|
||||
sz: {type: [String], required: true},
|
||||
tc: {type: [String], required: true},
|
||||
rm: {type: [String], required: true},
|
||||
cb: {type: [String], required: true}
|
||||
name: { type: String, required: true },
|
||||
sz: { type: [String], required: true },
|
||||
tc: { type: [String], required: true },
|
||||
rm: { type: [String], required: true },
|
||||
cb: { type: [String], required: true },
|
||||
order: Number,
|
||||
plus: {
|
||||
month: Number,
|
||||
year: Number,
|
||||
voter_count: Number,
|
||||
vote_counts: [
|
||||
{
|
||||
name: String,
|
||||
sz: [Number],
|
||||
tc: [Number],
|
||||
rm: [Number],
|
||||
cb: [Number],
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
module.exports = mongoose.model('Maplist', maplistSchema)
|
||||
module.exports = mongoose.model("Maplist", maplistSchema)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user