prow/github/fakegithub/fakegithub.go
func (f *FakeClient) MoveProjectCard(projectCardID int, newColumnID int) error {
	// Remove project card from old column
	newCards := []github.ProjectCard{}
	oldColumnID := -1
	projectCard := github.ProjectCard{}
	for column, cards := range f.ColumnCardsMap {
		removalIndex := -1
		for i, existingCard := range cards {
			if existingCard.ContentID == projectCardID {
				oldColumnID = column
				removalIndex = i
				projectCard = existingCard
				break
			}
		}
		if removalIndex != -1 {
			newCards = cards
			newCards[removalIndex] = newCards[len(newCards)-1]
			newCards = newCards[:len(newCards)-1]
		}
	}
	if oldColumnID != -1 {
		// Update the old column's list of project cards
		f.ColumnCardsMap[oldColumnID] = newCards
	}

	for project, columnIDMap := range f.ColumnIDMap {
		if columnName, exists := columnIDMap[newColumnID]; exists {
			// Add project card to new column
			f.ColumnCardsMap[newColumnID] = append(
				f.ColumnCardsMap[newColumnID],
				projectCard,
			)
			f.Column = columnName
			f.Project = project
			break
		}
	}

	return nil
}
func (f *FakeClient) MoveProjectCard(projectCardID int, newColumnID int) error {
	// Remove project card from old column
	newCards := []github.ProjectCard{}
	oldColumnID := -1
	projectCard := github.ProjectCard{}
	for column, cards := range f.ColumnCardsMap {
		removalIndex := -1
		for i, existingCard := range cards {
			if existingCard.ContentID == projectCardID {
				oldColumnID = column
				removalIndex = i
				projectCard = existingCard
				break
			}
		}
		if removalIndex != -1 {
			newCards = cards
			newCards[removalIndex] = newCards[len(newCards)-1]
			newCards = newCards[:len(newCards)-1]
		}
	}
	if oldColumnID != -1 {
		// Update the old column's list of project cards
		f.ColumnCardsMap[oldColumnID] = newCards
	}

	for project, columnIDMap := range f.ColumnIDMap {
		if columnName, exists := columnIDMap[newColumnID]; exists {
			// Add project card to new column
			f.ColumnCardsMap[newColumnID] = append(
				f.ColumnCardsMap[newColumnID],
				projectCard,
			)
			f.Column = columnName
			f.Project = project
			break
		}
	}

	return nil
}
func ( f * FakeClient ) MoveProjectCard ( projectCardID int , newColumnID int ) error { // Remove project card from old column newCards := [ ] github . ProjectCard { } oldColumnID := - 1 projectCard := github . ProjectCard { } for column , cards := range f . ColumnCardsMap { removalIndex := - 1 for i , existingCard := range cards { if existingCard . ContentID == projectCardID { oldColumnID = column removalIndex = i projectCard = existingCard break } } if removalIndex != - 1 { newCards = cards newCards [ removalIndex ] = newCards [ len ( newCards ) - 1 ] newCards = newCards [ : len ( newCards ) - 1 ] } } if oldColumnID != - 1 { // Update the old column's list of project cards f . ColumnCardsMap [ oldColumnID ] = newCards } for project , columnIDMap := range f . ColumnIDMap { if columnName , exists := columnIDMap [ newColumnID ] ; exists { // Add project card to new column f . ColumnCardsMap [ newColumnID ] = append ( f . ColumnCardsMap [ newColumnID ] , projectCard , ) f . Column = columnName f . Project = project break } } return nil }
// MoveProjectCard moves a specific project card to a specified column in the same project
MoveProjectCard moves a specific project card to a specified column in the same project