Commit 2ca638be authored by ganjingcun's avatar ganjingcun

add battle history

parent 936b6144
......@@ -144,6 +144,24 @@ router.post('/score', function (req, res) {
athletic_all = athletic_all + ${paramB.athletic_all}
where username = '${userB.username}'`)
queries.push(`insert into battle_history values (
'${userA.username}',
'${userB.username}',
'${userscoreA}',
'${userscoreB}',
'${expResult.expA}',
'${expResult.expB}',
'${userA.exp}',
'${userB.exp}',
'${ptResult.ptA}',
'${ptResult.ptB}',
'${userA.pt}',
'${userB.pt}',
'${arena}',
'${start}',
'${end}'
)`)
} else {
let expResult = utils.getExpScore(userA.exp, userB.exp, userscoreA, userscoreB)
......@@ -174,6 +192,24 @@ router.post('/score', function (req, res) {
entertain_all = entertain_all + ${paramB.entertain_all}
where username = '${userB.username}'`)
queries.push(`insert into battle_history values (
'${userA.username}',
'${userB.username}',
'${userscoreA}',
'${userscoreB}',
'${expResult.expA}',
'${expResult.expB}',
'${userA.exp}',
'${userB.exp}',
'${userA.pt}',
'${userB.pt}',
'${userA.pt}',
'${userB.pt}',
'${arena}',
'${start}',
'${end}'
)`)
}
queries.map(function (q) {
......
......@@ -22,14 +22,14 @@ superagent
console.log(res.text)
})
var Utils = require('./utils/utils')
// var Utils = require('./utils/utils')
console.log("pt test: ptA 1613 ,ptB 1573 draw => ", Utils.getEloScore(1613, 1573, 0.5, 0.5))
// console.log("pt test: ptA 1613 ,ptB 1573 draw => ", Utils.getEloScore(1613, 1573, 0.5, 0.5))
console.log("exp test: expA 100 ,expB 50 A win => ", Utils.getExpScore(100, 50, 2, 1))
console.log("exp test: expA 100 ,expB 50 B win => ", Utils.getExpScore(100, 50, 1, 2))
console.log("exp test: expA 100 ,expB 50 draw => ", Utils.getExpScore(100, 50, 2, 2))
// console.log("exp test: expA 100 ,expB 50 A win => ", Utils.getExpScore(100, 50, 2, 1))
// console.log("exp test: expA 100 ,expB 50 B win => ", Utils.getExpScore(100, 50, 1, 2))
// console.log("exp test: expA 100 ,expB 50 draw => ", Utils.getExpScore(100, 50, 2, 2))
console.log("exp test: expA 5 ,expB 5 A win => ", Utils.getExpScore(5, 5, 2, 1))
console.log("exp test: expA 5 ,expB 5 B win => ", Utils.getExpScore(5, 5, 1, 2))
console.log("exp test: expA 5 ,expB 5 draw => ", Utils.getExpScore(5, 5, 2, 2))
\ No newline at end of file
// console.log("exp test: expA 5 ,expB 5 A win => ", Utils.getExpScore(5, 5, 2, 1))
// console.log("exp test: expA 5 ,expB 5 B win => ", Utils.getExpScore(5, 5, 1, 2))
// console.log("exp test: expA 5 ,expB 5 draw => ", Utils.getExpScore(5, 5, 2, 2))
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment