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

moosetechnology / GitProjectHealth / 10880677211

16 Sep 2024 09:01AM UTC coverage: 20.332% (-0.2%) from 20.538%
10880677211

push

github

web-flow
Merge pull request #54 from moosetechnology/metrics-fixing

Metrics fixing

0 of 178 new or added lines in 19 files covered. (0.0%)

18 existing lines in 6 files now uncovered.

1961 of 9645 relevant lines covered (20.33%)

0.2 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

© 2025 Coveralls, Inc