@@ -80,16 +80,8 @@ impl Entry {
8080 }
8181 }
8282
83- pub fn activity_type ( & self ) -> ActivityType {
84- if self . name . ends_with ( "***" ) {
85- ActivityType :: Ignored
86- } else if self . name . ends_with ( "**" ) {
87- ActivityType :: Break
88- } else {
89- ActivityType :: Work
90- }
91- }
92-
83+
84+ // This method is used in Activity::new()
9385 pub fn project ( & self ) -> Option < String > {
9486 let re = Regex :: new ( r"^([^\s:]+):\s+(.+)$" ) . unwrap ( ) ;
9587
@@ -100,6 +92,7 @@ impl Entry {
10092 }
10193 }
10294
95+ // This method is used in Activity::new()
10396 pub fn task ( & self ) -> String {
10497 let re = Regex :: new ( r"^([^\s:]+):\s+(.+)$" ) . unwrap ( ) ;
10598
@@ -162,26 +155,4 @@ impl Activity {
162155 task,
163156 }
164157 }
165-
166- /// Clip the activity to a specific time range
167- pub fn clip ( & self , start : Option < DateTime < Local > > , end : Option < DateTime < Local > > ) -> Self {
168- let mut new_activity = self . clone ( ) ;
169-
170- if let Some ( start_time) = start {
171- if start_time > new_activity. start {
172- new_activity. start = start_time;
173- }
174- }
175-
176- if let Some ( end_time) = end {
177- if end_time < new_activity. end {
178- new_activity. end = end_time;
179- }
180- }
181-
182- // Recalculate duration
183- new_activity. duration = new_activity. end . signed_duration_since ( new_activity. start ) ;
184-
185- new_activity
186- }
187158}
0 commit comments