Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature jira email #44

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/GitLabHealth-Model-Analysis/GLHUserCatalogueV2.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down
26 changes: 23 additions & 3 deletions src/GitLabHealth-Model-Analysis/GitMetric4User.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [

Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 14 additions & 2 deletions src/GitLabHealth-Model-Analysis/GitMetricExporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ Class {
'runningPeriods',
'maxCommitWindow',
'over',
'analyses'
'analyses',
'emailDomain'
],
#category : #'GitLabHealth-Model-Analysis'
}



{ #category : #'as yet unclassified' }
GitMetricExporter class >> demoPeriod [

Expand All @@ -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 [

Expand Down Expand Up @@ -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"

Expand All @@ -486,6 +496,8 @@ GitMetricExporter >> setupAnalysisForUsersWithNames: userNames [
metrics := GitMetric4User new.
metrics
glhImporter: glhImporter;
jiraImporter: jiraImporter;
withUserEmailDomain: emailDomain;
user: user.

i := 0.
Expand Down
3 changes: 2 additions & 1 deletion src/GitLabHealth-Model-Importer/GLHModelImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,8 @@ GLHModelImporter >> userCatalogue [
{ #category : #accessing }
GLHModelImporter >> userCatalogue: aGLHUserCatalogue [

userCatalogue := aGLHUserCatalogue
userCatalogue := aGLHUserCatalogue.
aGLHUserCatalogue anImporter: self.
]

{ #category : #accessing }
Expand Down
Loading