Back to the console

ChallengeHub Activity Tracker

CourseSoftware Design Laboratory, MapĂșa UniversityMy roleIndividual submissionToolsPython, pytest, UMLTests18 of 18 passing

I rebuilt the Record Activity feature of a wellness challenge app so bad input is rejected before anything is saved, and a failed save can no longer corrupt data. All 18 tests pass.

The problem

Participants log activities such as kilometers walked or sessions attended, and progress is worked out from those records. Progress affects how people are judged, so a bad record or a half-written file would make the results wrong.

What I built

The six rules

Checks and their messages
CheckMessage when it fails
Participant existsUnknown participant
Challenge existsUnknown challenge
Participant joined the challengeParticipant is not enrolled
Amount above zeroAmount must be positive
Activity type matches the challengeActivity type does not match challenge
Date is inside the challenge periodActivity date is outside the challenge period

Testing

The 18 tests cover the original behavior, each of eight invalid requests, one valid request, a storage failure, an interrupted file write, and a check that the core code does not import storage or display modules. In my demo, an invalid amount of 0 changed nothing, with data files byte-for-byte identical.

Limits I documented

An activity dated before the participant joined is still accepted, because that rule was never decided. There is also no sign-in, so records cannot be tied to the person who submitted them.

Next reportCourse Compass