File tree Expand file tree Collapse file tree 3 files changed +36
-34
lines changed Expand file tree Collapse file tree 3 files changed +36
-34
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ export default class Bubble {
11
11
} ;
12
12
}
13
13
14
+ // End returns the Bubble's end date object
15
+ End ( ) {
16
+ return this . date . end ;
17
+ }
18
+
14
19
// Label returns the Bubble's label text
15
20
Label ( ) {
16
21
return this . label ;
@@ -20,9 +25,4 @@ export default class Bubble {
20
25
Start ( ) {
21
26
return this . date . start ;
22
27
}
23
-
24
- // End returns the Bubble's end date object
25
- End ( ) {
26
- return this . date . end ;
27
- }
28
28
}
Original file line number Diff line number Diff line change @@ -17,17 +17,6 @@ export default class List {
17
17
this . storage . sort ( this . sorter )
18
18
}
19
19
20
- // Next increase the position pointer and return the current element
21
- Next ( ) {
22
- this . position ++ ;
23
-
24
- if ( this . position > this . storage . length ) {
25
- return null ;
26
- }
27
-
28
- return this . storage [ this . position - 1 ] ;
29
- }
30
-
31
20
// Add can receive one or multiple parameters which are added to the List
32
21
Add ( ) {
33
22
for ( var i = 0 , m = arguments . length ; i < m ; i ++ ) {
@@ -37,28 +26,39 @@ export default class List {
37
26
this . sort ( ) ;
38
27
}
39
28
40
- // Walk is an alias for forEach
41
- Walk ( func ) {
42
- return this . storage . forEach ( func ) ;
43
- }
44
-
45
29
// First returns the first item of the List
46
30
First ( ) {
47
31
return this . storage [ 0 ]
48
32
}
49
33
34
+ // Get returns all items in the List
35
+ Get ( ) {
36
+ return this . storage ;
37
+ }
38
+
50
39
// Last returns the last item of the List
51
40
Last ( ) {
52
41
return this . storage [ this . Size ( ) - 1 ]
53
42
}
54
43
55
- // Get returns all items in the List
56
- Get ( ) {
57
- return this . storage ;
44
+ // Next increase the position pointer and return the current element
45
+ Next ( ) {
46
+ this . position ++ ;
47
+
48
+ if ( this . position > this . storage . length ) {
49
+ return null ;
50
+ }
51
+
52
+ return this . storage [ this . position - 1 ] ;
58
53
}
59
54
60
55
// Size returns the length of the List
61
56
Size ( ) {
62
57
return this . storage . length ;
63
58
}
59
+
60
+ // Walk is an alias for forEach
61
+ Walk ( func ) {
62
+ return this . storage . forEach ( func ) ;
63
+ }
64
64
}
Original file line number Diff line number Diff line change @@ -7,27 +7,29 @@ export default class Timesheet {
7
7
this . list = p . parse ( html )
8
8
}
9
9
10
- Start ( ) {
11
- var start = null ;
10
+ // End returns the last end date of all bubbles
11
+ End ( ) {
12
+ var end = null ;
12
13
13
14
this . list . Walk ( ( item ) => {
14
- if ( start === null || item . Start ( ) < start ) {
15
- start = item . Start ( ) ;
15
+ if ( end === null || item . End ( ) > end ) {
16
+ end = item . End ( ) ;
16
17
}
17
18
} ) ;
18
19
19
- return start ;
20
+ return end ;
20
21
}
21
22
22
- End ( ) {
23
- var end = null ;
23
+ // Start returns the earliest start date of all bubbles
24
+ Start ( ) {
25
+ var start = null ;
24
26
25
27
this . list . Walk ( ( item ) => {
26
- if ( end === null || item . End ( ) > end ) {
27
- end = item . End ( ) ;
28
+ if ( start === null || item . Start ( ) < start ) {
29
+ start = item . Start ( ) ;
28
30
}
29
31
} ) ;
30
32
31
- return end ;
33
+ return start ;
32
34
}
33
35
}
You can’t perform that action at this time.
0 commit comments