diff --git a/src/GitLabHealth-Model-Analysis/GLHUserCatalogueV2.class.st b/src/GitLabHealth-Model-Analysis/GLHUserCatalogueV2.class.st index d289db3..b9b6c58 100644 --- a/src/GitLabHealth-Model-Analysis/GLHUserCatalogueV2.class.st +++ b/src/GitLabHealth-Model-Analysis/GLHUserCatalogueV2.class.st @@ -11,15 +11,21 @@ GLHUserCatalogueV2 class >> loadFromJson: aString [ catalogue := self new. dic := (STONJSON fromString: aString) asDictionary. dic associationsDo: [ :assoc | - | itsName itsUsername itsCommitNames itsId| + | itsName itsUsername itsCommitNames itsId | itsName := assoc key. itsCommitNames := assoc value at: #foundNames. - itsUsername := assoc value at: #username. + itsUsername := assoc value at: #username. itsId := assoc value at: #id. - - catalogue addUser: (GLHUser new id: itsId; username: itsUsername; name: itsName; yourself ) withNames: itsCommitNames ]. - - ^ catalogue . + + catalogue + addUser: (GLHUser new + id: itsId; + username: itsUsername; + name: itsName; + yourself) + withNames: itsCommitNames ]. + + ^ catalogue ] { #category : #'as yet unclassified' } diff --git a/src/GitLabHealth-Model-Analysis/GitMetric4User.class.st b/src/GitLabHealth-Model-Analysis/GitMetric4User.class.st index f2e21d7..f1c2d1f 100644 --- a/src/GitLabHealth-Model-Analysis/GitMetric4User.class.st +++ b/src/GitLabHealth-Model-Analysis/GitMetric4User.class.st @@ -3,11 +3,26 @@ Class { #superclass : #GitMetric, #instVars : [ 'itsCommits', - 'itsMergeRequests' + 'itsMergeRequests', + 'emailDomain' ], #category : #'GitLabHealth-Model-Analysis' } +{ #category : #'email' } +GitMetric4User >> withUserEmailDomain: aEmailDomain [ + emailDomain := aEmailDomain. +] + +{ #category : #'email' } +GitMetric4User >> userEmail [ + "overide this method to adapt on your situation" + + ^ ('' join: { + user username. + emailDomain }) asLowercase. +] + { #category : #'metrics - commits' } GitMetric4User >> averageTimeBetweenCommitSince: since until: until overA: aDateWeekMonthOrYear [ @@ -663,7 +678,9 @@ GitMetric4User >> initialize [ user := GLHUser new. itsProjects := Dictionary new. itsCommits := Dictionary new. - itsMergeRequests := Dictionary new + itsMergeRequests := Dictionary new. + + emailDomain := '@generic-domain.com' ] { #category : #accessing } @@ -691,12 +708,15 @@ GitMetric4User >> loadCommitOfProjects: aCollection since: aTimespan [ { #category : #loading } GitMetric4User >> loadItsMergeRequesWithJiraIssueSince: since until: until [ + |email| itsMergeRequests := self loadItsMergeRequestsSince: since until: until. + email := self userEmail. + jiraImporter importAllCurrentAndPastIssuesOf: - user commits anyOne author_email. + email. GPJCConnector new gpModel: glhImporter glhModel; diff --git a/src/GitLabHealth-Model-Analysis/GitMetricExporter.class.st b/src/GitLabHealth-Model-Analysis/GitMetricExporter.class.st index 6d55fcd..a7fc98d 100644 --- a/src/GitLabHealth-Model-Analysis/GitMetricExporter.class.st +++ b/src/GitLabHealth-Model-Analysis/GitMetricExporter.class.st @@ -11,11 +11,14 @@ Class { 'runningPeriods', 'maxCommitWindow', 'over', - 'analyses' + 'analyses', + 'emailDomain' ], #category : #'GitLabHealth-Model-Analysis' } + + { #category : #'as yet unclassified' } GitMetricExporter class >> demoPeriod [ @@ -25,6 +28,13 @@ GitMetricExporter class >> demoPeriod [ addAPeriodFrom: '01 march 2024' to: '31 may 2024' ] +{ #category : #setup } +GitMetricExporter >> withEmailDomain: anEmailDomain [ + + "define the email domain of your Git user. Usefull to link them between service (i.e. Jira)" + emailDomain := anEmailDomain +] + { #category : #adding } GitMetricExporter >> addAPeriodFrom: since to: until [ @@ -469,7 +479,7 @@ GitMetricExporter >> onlyImportProjectsOfGroup: groupId [ projectCache := group toScope: GLHProject ] -{ #category : #adding } +{ #category : #setup } GitMetricExporter >> setupAnalysisForUsersWithNames: userNames [ "import all the project since a certain time" @@ -486,6 +496,8 @@ GitMetricExporter >> setupAnalysisForUsersWithNames: userNames [ metrics := GitMetric4User new. metrics glhImporter: glhImporter; + jiraImporter: jiraImporter; + withUserEmailDomain: emailDomain; user: user. i := 0. diff --git a/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st b/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st index 69008a4..108b819 100644 --- a/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st +++ b/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st @@ -1155,7 +1155,8 @@ GLHModelImporter >> userCatalogue [ { #category : #accessing } GLHModelImporter >> userCatalogue: aGLHUserCatalogue [ - userCatalogue := aGLHUserCatalogue + userCatalogue := aGLHUserCatalogue. + aGLHUserCatalogue anImporter: self. ] { #category : #accessing }