Skip to content

Commit

Permalink
feat: add numberOfMergedMergeRequest in analysis report and in csv ex…
Browse files Browse the repository at this point in the history
…port
  • Loading branch information
knowbased committed Aug 20, 2024
1 parent 38fa48f commit cd9597e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
15 changes: 14 additions & 1 deletion src/GitLabHealth-Model-Analysis/AnalysisReport.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Class {
'delayUntilFirstChurn',
'numberOfProjectWithCommit',
'averageTimeBetweenCommits',
'averageNumberOfOpenMergeRequest'
'averageNumberOfOpenMergeRequest',
'averageNumberOfMergedMergeRequest'
],
#category : #'GitLabHealth-Model-Analysis'
}
Expand All @@ -24,6 +25,18 @@ AnalysisReport class >> isVoyageRoot [
^true
]

{ #category : #accessing }
AnalysisReport >> averageNumberOfMergedMergeRequest [

^ averageNumberOfMergedMergeRequest
]

{ #category : #accessing }
AnalysisReport >> averageNumberOfMergedMergeRequest: anObject [

averageNumberOfMergedMergeRequest := anObject
]

{ #category : #accessing }
AnalysisReport >> averageNumberOfOpenMergeRequest [

Expand Down
18 changes: 12 additions & 6 deletions src/GitLabHealth-Model-Analysis/GitMetric4User.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ GitMetric4User >> foundSuccessorOf: userCommits andCompleteImportForMax: commitL
{ #category : #analysis }
GitMetric4User >> generateAnalysisForPeriod: period over: aDateWeekMonthOrYear withMaxCommitWindows: maxCommitWindow [

| contribution commitFrequency commentContribution mergeRequestDuration codeChurn delayUntilFirstChurn averageTimeBetweenCommits numberOfProjectWithCommit until since numberOfOpenMergeRequest |
| contribution commitFrequency commentContribution mergeRequestDuration codeChurn delayUntilFirstChurn averageTimeBetweenCommits numberOfProjectWithCommit until since numberOfOpenMergeRequest numberOfMergedMergeRequest |
since := period at: #since.
until := period at: #until.

Expand Down Expand Up @@ -620,10 +620,14 @@ GitMetric4User >> generateAnalysisForPeriod: period over: aDateWeekMonthOrYear w
overA: aDateWeekMonthOrYear.

numberOfOpenMergeRequest := self
numberOfOpenMergeRequestSince:
since
until: until
overA: aDateWeekMonthOrYear.
numberOfOpenMergeRequestSince: since
until: until
overA: aDateWeekMonthOrYear.

numberOfMergedMergeRequest := self
numberOfMergedMergeRequestSince: since
until: until
overA: aDateWeekMonthOrYear.

^ AnalysisReport new
username: self user name;
Expand All @@ -641,7 +645,9 @@ GitMetric4User >> generateAnalysisForPeriod: period over: aDateWeekMonthOrYear w
averageTimeBetweenCommits:
(averageTimeBetweenCommits at: #average);
averageNumberOfOpenMergeRequest:
(numberOfOpenMergeRequest at: #average)
(numberOfOpenMergeRequest at: #average);
averageNumberOfMergedMergeRequest:
(numberOfMergedMergeRequest at: #average)
]

{ #category : #initialization }
Expand Down
12 changes: 10 additions & 2 deletions src/GitLabHealth-Model-Analysis/GitMetricExporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,19 @@ GitMetricExporter >> exportInCSV [
exportBrowserModel
addColumnForQuery: [ :analysis | analysis averageTimeBetweenCommits ]
withName: 'average time between commits' asSymbol.

"average number of open merge request"
exportBrowserModel
addColumnForQuery: [ :analysis | analysis averageNumberOfOpenMergeRequest ]
addColumnForQuery: [ :analysis |
analysis averageNumberOfOpenMergeRequest ]
withName: 'average number of open merge request' asSymbol.


"average number of merged merge request"
exportBrowserModel
addColumnForQuery: [ :analysis |
analysis averageNumberOfMergedMergeRequest ]
withName: 'average number of merged merge request' asSymbol.

file := self constructFilePath: over.
file writeStreamDo: [ :aStream |
Expand Down

0 comments on commit cd9597e

Please sign in to comment.