@@ -16,7 +16,7 @@ use typed_builder::TypedBuilder;
1616use ulid:: Ulid ;
1717
1818use crate :: {
19- domain:: status:: ActivityStatus ,
19+ domain:: status:: ActivityStatusKind ,
2020 error:: { ActivityLogErrorKind , PaceResult } ,
2121} ;
2222
@@ -246,7 +246,7 @@ pub struct Activity {
246246 #[ serde( default ) ]
247247 #[ builder( default ) ]
248248 #[ merge( strategy = crate :: util:: overwrite_left_with_right) ]
249- status : ActivityStatus ,
249+ status : ActivityStatusKind ,
250250}
251251
252252#[ derive(
@@ -357,40 +357,40 @@ impl Activity {
357357 }
358358
359359 /// If the activity is held
360- pub fn is_held ( & self ) -> bool {
360+ pub fn is_paused ( & self ) -> bool {
361361 debug ! ( "Checking if activity is held: {:?}" , self ) ;
362- self . status . is_held ( )
362+ self . status . is_paused ( )
363363 }
364364
365365 /// If the activity is active, so if it is currently being tracked
366366 /// Intermissions are not considered active activities, please use
367367 /// [`is_active_intermission`] for that
368368 #[ must_use]
369- pub fn is_active ( & self ) -> bool {
369+ pub fn is_in_progress ( & self ) -> bool {
370370 debug ! ( "Checking if activity is active: {:?}" , self ) ;
371371 self . activity_end_options ( ) . is_none ( )
372372 && ( !self . kind . is_intermission ( ) || !self . kind . is_pomodoro_intermission ( ) )
373- && self . status . is_active ( )
373+ && self . status . is_in_progress ( )
374374 }
375375
376376 /// Make the activity active
377377 pub fn make_active ( & mut self ) {
378378 debug ! ( "Making activity active: {:?}" , self ) ;
379- self . status = ActivityStatus :: Active ;
379+ self . status = ActivityStatusKind :: InProgress ;
380380 }
381381
382382 /// Make the activity inactive
383383 pub fn make_inactive ( & mut self ) {
384384 debug ! ( "Making activity inactive: {:?}" , self ) ;
385- self . status = ActivityStatus :: Inactive ;
385+ self . status = ActivityStatusKind :: Created ;
386386 }
387387
388388 /// Archive the activity
389389 /// This is only possible if the activity is not active and has ended
390390 pub fn archive ( & mut self ) {
391- if !self . is_active ( ) && self . has_ended ( ) {
391+ if !self . is_in_progress ( ) && self . is_completed ( ) {
392392 debug ! ( "Archiving activity: {:?}" , self ) ;
393- self . status = ActivityStatus :: Archived ;
393+ self . status = ActivityStatusKind :: Archived ;
394394 }
395395 }
396396
@@ -399,14 +399,14 @@ impl Activity {
399399 pub fn unarchive ( & mut self ) {
400400 if self . is_archived ( ) {
401401 debug ! ( "Unarchiving activity: {:?}" , self ) ;
402- self . status = ActivityStatus :: Unarchived ;
402+ self . status = ActivityStatusKind :: Unarchived ;
403403 }
404404 }
405405
406406 /// If the activity is endable, meaning if it is active or held
407- pub fn is_endable ( & self ) -> bool {
407+ pub fn is_completable ( & self ) -> bool {
408408 debug ! ( "Checking if activity is endable: {:?}" , self ) ;
409- self . is_active ( ) || self . is_held ( )
409+ self . is_in_progress ( ) || self . is_paused ( )
410410 }
411411
412412 /// If the activity is an active intermission
@@ -415,7 +415,7 @@ impl Activity {
415415 debug ! ( "Checking if activity is an active intermission: {:?}" , self ) ;
416416 self . activity_end_options ( ) . is_none ( )
417417 && ( self . kind . is_intermission ( ) || self . kind . is_pomodoro_intermission ( ) )
418- && self . status . is_active ( )
418+ && self . status . is_in_progress ( )
419419 }
420420
421421 /// If the activity is archived
@@ -429,24 +429,24 @@ impl Activity {
429429 #[ must_use]
430430 pub fn is_inactive ( & self ) -> bool {
431431 debug ! ( "Checking if activity is inactive: {:?}" , self ) ;
432- self . status . is_inactive ( )
432+ self . status . is_created ( )
433433 }
434434
435435 /// If the activity has ended and is not archived
436436 #[ must_use]
437- pub fn has_ended ( & self ) -> bool {
437+ pub fn is_completed ( & self ) -> bool {
438438 debug ! ( "Checking if activity has ended: {:?}" , self ) ;
439439 self . activity_end_options ( ) . is_some ( )
440440 && ( !self . kind . is_intermission ( ) || !self . kind . is_pomodoro_intermission ( ) )
441441 && !self . is_archived ( )
442- && self . status . is_ended ( )
442+ && self . status . is_completed ( )
443443 }
444444
445445 /// If the activity is resumable
446446 #[ must_use]
447447 pub fn is_resumable ( & self ) -> bool {
448448 debug ! ( "Checking if activity is resumable: {:?}" , self ) ;
449- self . is_inactive ( ) || self . is_archived ( ) || self . is_held ( ) || self . has_ended ( )
449+ self . is_inactive ( ) || self . is_archived ( ) || self . is_paused ( ) || self . is_completed ( )
450450 }
451451
452452 /// End the activity
@@ -458,7 +458,7 @@ impl Activity {
458458 pub fn end_activity ( & mut self , end_opts : ActivityEndOptions ) {
459459 debug ! ( "Ending activity: {:?}" , self ) ;
460460 self . activity_end_options = Some ( end_opts) ;
461- self . status = ActivityStatus :: Ended ;
461+ self . status = ActivityStatusKind :: Completed ;
462462 }
463463
464464 /// End the activity with a given end date and time
0 commit comments