All problems

A Loom Counter Reset Drops New Production

Level 2 · node · Data · Reset handling for cumulative counters

Scenario

A fictional weaving studio logs the cumulative meters on each loom. A replacement counter starts at zero; the next recorded value includes the meters woven since replacement. Some reports miss this post-replacement output.

Requirements

Use the first observation only as the baseline. Sum production increments for subsequent readings. When the counter decreases, add the current reading as output since the reset.

Acceptance criteria

  • Sum adjacent increases when readings only rise.
  • When a reading falls, include the current reading as post-reset production.
  • Count each reset and normal increase across several resets.
  • Return zero when there is only one observation.