Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

2.2 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
6a1d9f98e819ed70a0e994de Challenge 332: Issue Triage 29 challenge-332

--description--

Given a number of milliseconds since the last post on an issue, and the last message posted on the issue, determine what you should do with the issue according to these rules:

  • If the last message is less than 7 days ago, return "leave it"
  • If the last message is 7 or more days ago and its content contains "bump" (case-insensitive), return "close it"
  • Otherwise, return "bump it"

--hints--

triage_issue(86400000, "Lets fix it") should return "leave it".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(triage_issue(86400000, "Lets fix it"), "leave it")`)
}})

triage_issue(1209600000, "still waiting") should return "bump it".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(triage_issue(1209600000, "still waiting"), "bump it")`)
}})

triage_issue(864000000, "bump") should return "close it".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(triage_issue(864000000, "bump"), "close it")`)
}})

triage_issue(604800000, "Do we still want this?") should return "bump it".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(triage_issue(604800000, "Do we still want this?"), "bump it")`)
}})

triage_issue(604800000, "Bumping this") should return "close it".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(triage_issue(604800000, "Bumping this"), "close it")`)
}})

triage_issue(345600000, "I'll make a PR") should return "leave it".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(triage_issue(345600000, "I'll make a PR"), "leave it")`)
}})

--seed--

--seed-contents--

def triage_issue(ms, message):

    return ms

--solutions--

def triage_issue(ms, message):
    seven_days = 7 * 24 * 60 * 60 * 1000
    if ms < seven_days:
        return "leave it"
    if "bump" in message.lower():
        return "close it"
    return "bump it"