NTP-24894 | quick fix for reporting teams. (#479)
* NTP-24894 | Text change in slack modal. * NTP-24894 | Adding more constant teamTypes. * NTP-24894 | Added functions to allow for teamType update. * NTP-24894 | Added validation in addTeamRequest. * NTP-24894 | Comment resolution and new functions (#477) * NTP-24894 | Added filter on Reporting teams. * NTP-24894 | Added new function for all teams fetch in team service. * NTP-24894 | sending all teams in response for slack modal. * NTP-24894 | Added tests for UpdateTeam flow. * NTP-24894 | Fixing logic and using util. * NTP-24894 | Using enum-map for teamType validation. * NTP-24894 | Variable name change. * NTP-24894 | Adding teamType to TeamDTOs when fetching using productid. * NTP-24894 | Revisions in function for team population. * NTP-24894 | Removed unneeded function. * NTP-24894 | Removed unneeded interface of function * NTP-24894 | Updated test scripts. * NTP-24894 | Logic changes, modal text change. * NTP-24894 | Using ID for first occurence, updated tests. * NTP-40086 | Selective filtering based on Product. * NTP-40086 | Updated tests for incident_orch. * NTP-40086 | replaced with constants. * NTP-24894 | Moved functions to teamService. * NTP-40086 | added new function in repo for filtering during fetch. * NTP-40086 | Removed unused function. * NTP-40086 | added tests and removed interface of previously removed fuc. * NTP-40086 | Added direct filtering function during data fetch from repo. * NTP-40086 | Refactoring and adding more tests. * NTP-24894 | Text changed in incident summary. * NTP-40086 | Refactoring function. * NTP-40086 | Editting team service for unused functions. * NTP-40086 | Added new util function for generic intersection. * NTP-40086 | Text changed at multiple places. * NTP-40086 | Text change. * NTP-40086 | text change. * NTP-40086 | Added flags for reporter teams fetch.
This commit is contained in:
committed by
GitHub
parent
5ee1809c7a
commit
ab14dcffa5
@@ -40,7 +40,7 @@ func RollbackTransaction(tx *gorm.DB) {
|
||||
}
|
||||
}
|
||||
|
||||
func RemoveDuplicate[T string | int](sliceList []T) []T {
|
||||
func RemoveDuplicate[T string | uint](sliceList []T) []T {
|
||||
allKeys := make(map[T]bool)
|
||||
list := []T{}
|
||||
for _, item := range sliceList {
|
||||
|
||||
@@ -133,7 +133,7 @@ func (i *incidentOrchestratorImpl) GetResponderTeamsForUpdate(
|
||||
productIDs = append(productIDs, p.ID)
|
||||
}
|
||||
}
|
||||
teamsOfProducts, err := i.getTeamsOfProducts(productIDs)
|
||||
teamsOfProducts, err := i.getTeamsOfProducts(productIDs, true)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
@@ -184,16 +184,20 @@ func (i *incidentOrchestratorImpl) getReportingAndResponderTeams(
|
||||
teamsOfUser = append(teamsOfUser, *defaultTeam)
|
||||
}
|
||||
|
||||
teamsOfProducts, err := i.getTeamsOfProducts(productIDs)
|
||||
teamsOfProducts, err := i.getTeamsOfProducts(productIDs, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sort.Sort(sortListOfTeamDTOByName(teamsOfProducts.Teams))
|
||||
sort.Sort(sortListOfTeamDTOByName(teamsOfUser))
|
||||
|
||||
teamsForReporting, err := i.getTeamsOfProducts(productIDs, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var reportingTeams []team.TeamDTO
|
||||
reportingTeams = append(reportingTeams, teamsOfProducts.Teams...)
|
||||
reportingTeams = util.RemoveDuplicates(reportingTeams, "ID").([]team.TeamDTO)
|
||||
reportingTeams = append(reportingTeams, teamsForReporting.Teams...)
|
||||
|
||||
var defaultSelectedReportingTeam *team.TeamDTO = nil
|
||||
commonTeams := util.GenericIntersection(reportingTeams, teamsOfUser, func(t team.TeamDTO) uint { return t.ID })
|
||||
@@ -290,12 +294,16 @@ func (i *incidentOrchestratorImpl) getTeamByUserDTO(userDTO *user2.UserDTO) []te
|
||||
return teams
|
||||
}
|
||||
|
||||
func (i *incidentOrchestratorImpl) getTeamsOfProducts(productIDs []uint) (*response.ProductAndUserTeams, error) {
|
||||
func (i *incidentOrchestratorImpl) getTeamsOfProducts(productIDs []uint, fetchReporterTeams bool) (*response.ProductAndUserTeams, error) {
|
||||
defaultProduct, err := i.productsService.GetDefaultProduct()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if fetchReporterTeams {
|
||||
productIDs = append(productIDs, defaultProduct.ProductID)
|
||||
productIDs = util.RemoveDuplicate(productIDs)
|
||||
}
|
||||
productTeamDTO, err := i.productTeamService.GetProductTeamsByProductIDs(productIDs, defaultProduct)
|
||||
if err != nil {
|
||||
logger.Error(fmt.Sprintf("%s Error in fetching product teams", logTag), zap.Error(err))
|
||||
|
||||
Reference in New Issue
Block a user