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

moosetechnology / GitProjectHealth / 10849645153

13 Sep 2024 01:03PM UTC coverage: 17.669%. First build
10849645153

Pull #54

github

web-flow
Merge 9d4695b3c into 6bbc9cee6
Pull Request #54: Metrics fixing

0 of 156 new or added lines in 17 files covered. (0.0%)

1589 of 8993 relevant lines covered (17.67%)

0.18 hits per line

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

0.0
/src/GitLabHealth-Model-Analysis/MergeRequestDurationMetric.class.st
1
Class {
2
        #name : #MergeRequestDurationMetric,
3
        #superclass : #UserMergeRequestMetric,
4
        #category : #'GitLabHealth-Model-Analysis'
5
}
6

7
{ #category : #calculating }
8
MergeRequestDurationMetric >> calculate [
×
9

×
10
        | groupedByDate gitAnalyzer mergeRequestsValidation filterGroups |
×
11
        userMergeRequests ifNil: [ self load ].
×
12
        groupedByDate := self setupGroupedDate.
×
13

×
14
        userMergeRequests ifEmpty: [ ^ nil ].
×
15

×
16
        gitAnalyzer := GitAnalyzer new.
×
17

×
18
        mergeRequestsValidation := userMergeRequests collect: [ :mr |
×
19
                                           gitAnalyzer
×
20
                                                   analyseMergeResquestValidation: mr ].
×
21

×
22

×
23
        mergeRequestsValidation do: [ :dic |
×
24
                | overDate |
×
25
                overDate := self transformDate: (dic at: #created_at) to: over.
×
26

×
27
                groupedByDate
×
28
                        at: overDate printString
×
29
                        ifPresent: [ :durations | durations add: (dic at: #duration) ]
×
30
                        ifAbsentPut: [
×
31
                                OrderedCollection new
×
32
                                        add: (dic at: #duration);
×
33
                                        yourself ] ].
×
34

×
35

×
36
        filterGroups := groupedByDate reject: [ :array | array isEmpty ].
×
37

×
38
        filterGroups associations do: [ :assoc |
×
39
                | sum denominator |
×
40
                denominator := assoc value size.
×
41

×
42
                sum := assoc value sum: [ :v |
×
43
                               v ifNil: [
×
44
                                       denominator := denominator - 1.
×
45
                                       0 asDuration ] ].
×
46
                denominator = 0 ifTrue: [ denominator := 1 ].
×
47

×
48
                filterGroups at: assoc key put: sum / denominator ].
×
49

×
50
        ^ filterGroups average asSeconds
×
51
]
×
52

53
{ #category : #accessing }
54
MergeRequestDurationMetric >> description [
×
55

×
NEW
56
        ^ 'average time to merge a merge request (in seconds)'
×
57
]
×
58

59
{ #category : #accessing }
60
MergeRequestDurationMetric >> name [
×
61

×
62
        ^ 'mergeRequestDuration'
×
63
]
×
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