package Ġcom . ban to lo me us . service Ċ Ċ import Ġcom . ban to lo me us . date . DI VIS OR _ FOR _ DAY Ċ import Ġcom . ban to lo me us . dto . Progress File DTO Ċ import Ġcom . ban to lo me us . repository . Challenge Repository Ċ import Ġcom . ban to lo me us . repository . Progress Repository Ċ import Ġorg . springframework . stereotype . Service Ċ import Ġjava . util .* Ċ Ċ @ Service Ċ class ĠProgress Service ( private Ġval Ġprogress Repository : ĠProgress Repository , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġprivate Ġval Ġchallenge Repository : ĠChallenge Repository ) Ġ{ ĊĊĠĠĠ Ġfun Ġsave Progress ( pages : ĠLong ): ĠProgress File DTO Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġprogress Ġ= Ġprogress Repository . get Progress () ĊĠĠĠĠĠĠĠ Ġprogress . pages E ver Read Ġ= Ġprogress . pages E ver Read . plus ( pages ) ĊĠĠĠĠĠĠĠ Ġprogress . pages Read In Current Challenge Ġ= Ġprogress . pages Read In Current Challenge . plus ( pages ) ĊĠĠĠĠĠĠĠ Ġreturn Ġprogress Repository . save Progress ( progress ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġcalculate Reading State (): ĠLong Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdays Since Start Ġ= Ġ(( Date (). time Ġ- Ġchallenge Repository . get StartTime ()) Ġ/ ĠDIV IS OR _ FOR _ DAY ) ĊĠĠĠĠĠĠĠ Ġval Ġpages Per Day Ġ= Ġchallenge Repository . get Challenge (). pages Per Day ĊĠĠĠĠĠĠĠ Ġval Ġpages Since Start Ġ= Ġprogress Repository . get Progress (). pages Read In Current Challenge ĊĠĠĠĠĠĠĠ Ġreturn Ġ(- days Since Start ). times ( pages Per Day ). plus ( pages Since Start ) ĊĠĠĠ Ġ} Ċ } Ċ