message: Replace dummy evidence with cheat score payload properties
diff: @@ -12,12 +12,15 @@ const os = require('os')
  const config = require('config')
  const post = promisify(request.post)
  +const solves = []
  +
  exports.notify = async (challenge, webhook = process.env.SOLUTIONS_WEBHOOK) => {
  const res = await post(webhook, {
  json: {
  solution: {
  challenge: challenge.key,
  - evidence: null,
  + cheatScore: calculateCheatScore(challenge),
  + totalCheatScore: solves.length > 0 ? solves.map(({ cheatScore }) => cheatScore).reduce((sum, score) => { return sum + score }) / solves.length : 0,
  issuedOn: new Date().toISOString()
  },
  ctfFlag: utils.ctfFlag(challenge.name),
  @@ -32,3 +35,14 @@ exports.notify = async (challenge, webhook = process.env.SOLUTIONS_WEBHOOK) => {
  })
  logger.info(`Webhook ${colors.bold(webhook)} notified about ${colors.cyan(challenge.key)} being solved: ${res.statusCode < 400 ? colors.green(res.statusCode) : colors.red(res.statusCode)}`)
  }
  +
  +function calculateCheatScore (challenge) {
  + const timestamp = new Date()
  + let cheatScore = 0
  + if (solves.length > 0) {
  + const minutesSincePreviousSolve = (timestamp.getTime() - solves[solves.length - 1].timestamp.getTime()) / 60000
  + cheatScore += Math.max(0, 1 - (minutesSincePreviousSolve / (2 * challenge.difficulty)))
  + }
  + solves.push({ challenge, timestamp, cheatScore })
  + return cheatScore
  +}
  