• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moosetechnology / GitProjectHealth / 10664257731

02 Sep 2024 09:11AM UTC coverage: 18.06%. First build
10664257731

Pull #46

github

web-flow
Merge f972c3087 into 3d150934d
Pull Request #46: refactor: change metric structure

0 of 840 new or added lines in 23 files covered. (0.0%)

1590 of 8804 relevant lines covered (18.06%)

0.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/GitLabHealth-Model-Analysis/Metric.class.st
1
Class {
2
        #name : #Metric,
3
        #superclass : #Object,
4
        #instVars : [
5
                'period',
6
                'over'
7
        ],
8
        #category : #'GitLabHealth-Model-Analysis'
9
}
10

11
{ #category : #calculating }
12
Metric >> calculate [
13

14
        ^self subclassResponsibility
15
]
16

17
{ #category : #accessing }
18
Metric >> description [
19

20
        ^ self subclassResponsibility
21
]
22

23
{ #category : #loading }
24
Metric >> load [
25
        ^self subclassResponsibility
26
]
27

28
{ #category : #accessing }
29
Metric >> name [
30

31
        ^ self subclassResponsibility
32
]
33

34
{ #category : #accessing }
NEW
35
Metric >> over: anObject [
×
NEW
36

×
NEW
37
        over := anObject
×
NEW
38
]
×
39

40
{ #category : #initialization }
NEW
41
Metric >> setPeriodSince: since until: until [
×
NEW
42

×
NEW
43
        period :=  {
×
NEW
44
                        (#since -> since asDate).
×
NEW
45
                        (#until -> until asDate) } asDictionary
×
NEW
46
]
×
47

48
{ #category : #'utils - date' }
NEW
49
Metric >> setupGroupedDate [
×
NEW
50

×
NEW
51
        | groupedByDate start end increment overSymbol |
×
NEW
52
        groupedByDate := OrderedDictionary new.
×
NEW
53

×
NEW
54
        increment := 1.
×
NEW
55
        start := self transformDate: (period at: #since) to: over.
×
NEW
56
        end := self transformDate: (period at: #until) to: over.
×
NEW
57

×
NEW
58
        groupedByDate
×
NEW
59
                at: start printString
×
NEW
60
                ifAbsentPut: [ OrderedCollection new ].
×
NEW
61

×
NEW
62
        overSymbol := over name asLowercase asSymbol.
×
NEW
63
        overSymbol = #date ifTrue: [ over := #day ].
×
NEW
64
        overSymbol = #month ifTrue: [
×
NEW
65
                increment := 32.
×
NEW
66
                over := #day ].
×
NEW
67

×
NEW
68

×
NEW
69
        [ groupedByDate keys last asDateAndTime < end ] whileTrue: [
×
NEW
70
                | index |
×
NEW
71
                index := groupedByDate keys last asDateAndTime
×
NEW
72
                         + (increment perform: overSymbol).
×
NEW
73
                index := self transformDate: index to: over.
×
NEW
74
                groupedByDate
×
NEW
75
                        at: index printString
×
NEW
76
                        ifAbsentPut: [ OrderedCollection new ] ].
×
NEW
77

×
NEW
78

×
NEW
79
        over = #day ifTrue: [
×
NEW
80
                groupedByDate := (groupedByDate associations select: [ :date |
×
NEW
81
                                          | aWeekday |
×
NEW
82
                                          aWeekday := date key asDate weekday.
×
NEW
83
                                          (aWeekday = #Sunday or: [ aWeekday = #Saturday ])
×
NEW
84
                                                  not ]) asOrderedDictionary ].
×
NEW
85

×
NEW
86

×
NEW
87
        groupedByDate
×
NEW
88
                at: end printString
×
NEW
89
                ifAbsentPut: [ OrderedCollection new ].
×
NEW
90

×
NEW
91
        ^ groupedByDate
×
NEW
92
]
×
93

94
{ #category : #'utils - date' }
NEW
95
Metric >> transformDate: date to: aWeekOrMonthOrYear [
×
NEW
96

×
NEW
97
        aWeekOrMonthOrYear = Month ifTrue: [ ^ date asDate month asDate ].
×
NEW
98

×
NEW
99
        ^ (date asDate perform: ('as' , aWeekOrMonthOrYear name) asSymbol)
×
NEW
100
                  asDate
×
NEW
101
]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc