Welcome to the news analytics team. hits/ counts how often each story on the market news feed is opened; the rules are in README.md. Three items are open: a wrong count at the edge of the window, a counter that slows dow…
Welcome to the news analytics team. hits/ counts how often each story on the market news feed is opened; the rules are in README.md. Three items are open: a wrong count at the edge of the window, a counter that slows down as the day goes on, and a new query the panel needs.
You have 35 minutes. The checks are graded one by one, so each part you get working counts even if the rest is not done.
A story opened once at second 1 still shows one view at second 301, a full five minutes later.
t is counted up to t + 299 and not at t + 300.By the afternoon, each count on a busy story takes longer than the one before, and the panel times out.
hit and count stay fast however long the counter runs and however many hits arrive in one second.count returns does not change.count_since(timestamp, seconds) counts the hits in the last seconds seconds, as the README describes.seconds above 300 counts the whole window; seconds of 0 or less gives 0.pytest tests/visible. Four tests fail on the current code.Visible test command
pytest tests/visibleThe repository’s own tests. Run all tests includes them, and so does every submission.
Repository
hit-counter-five-minute-window-constant-time-and-shorter-windows
Changes under src/ are evaluated.