func (c *SpaceIterationsController) List(ctx *app.ListSpaceIterationsContext) error {
	spaceID, err := uuid.FromString(ctx.ID)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, goa.ErrNotFound(err.Error()))
	}

	return application.Transactional(c.db, func(appl application.Application) error {

		_, err = appl.Spaces().Load(ctx, spaceID)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, goa.ErrNotFound(err.Error()))
		}
		iterations, err := appl.Iterations().List(ctx, spaceID)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		return ctx.ConditionalEntities(iterations, c.config.GetCacheControlIteration, func() error {
			itrMap := make(iterationIDMap)
			for _, itr := range iterations {
				itrMap[itr.ID] = itr
			}
			// fetch extra information(counts of WI in each iteration of the space) to be added in response
			wiCounts, err := appl.WorkItems().GetCountsPerIteration(ctx, spaceID)
			logrus.Info("Retrieving wicounts for spaceID ", spaceID.String(), " -> ", wiCounts)
			if err != nil {
				return jsonapi.JSONErrorResponse(ctx, err)
			}
			res := &app.IterationList{}
			res.Data = ConvertIterations(ctx.RequestData, iterations, updateIterationsWithCounts(wiCounts), parentPathResolver(itrMap))
			return ctx.OK(res)
		})
	})
}
// List runs the list action.
List runs the list action.
// List runs the list action .
func (c *SpaceIterationsController) List(ctx *app.ListSpaceIterationsContext) error {
	spaceID, err := uuid.FromString(ctx.ID)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, goa.ErrNotFound(err.Error()))
	}
	return application.Transactional(c.db, func(appl application.Application) error {
		_, err = appl.Spaces().Load(ctx, spaceID)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, goa.ErrNotFound(err.Error()))
		}
		iterations, err := appl.Iterations().List(ctx, spaceID)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		return ctx.ConditionalEntities(iterations, c.config.GetCacheControlIteration, func() error {
			itrMap := make(iterationIDMap)
			for _, itr := range iterations {
				itrMap[itr.ID] = itr
			}
			wiCounts, err := appl.WorkItems().GetCountsPerIteration(ctx, spaceID)
			logrus.Info("Retrieving wicounts for spaceID ", spaceID.String(), " -> ", wiCounts)
			if err != nil {
				return jsonapi.JSONErrorResponse(ctx, err)
			}
			res := &app.IterationList{}
			res.Data = ConvertIterations(ctx.RequestData, iterations, updateIterationsWithCounts(wiCounts), parentPathResolver(itrMap))
			return ctx.OK(res)
		})
	})
}
func ( c * SpaceIterationsController ) List ( ctx * app . ListSpaceIterationsContext ) error { spaceID , err := uuid . FromString ( ctx . ID ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , goa . ErrNotFound ( err . Error ( ) ) ) } return application . Transactional ( c . db , func ( appl application . Application ) error { _ , err = appl . Spaces ( ) . Load ( ctx , spaceID ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , goa . ErrNotFound ( err . Error ( ) ) ) } iterations , err := appl . Iterations ( ) . List ( ctx , spaceID ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , err ) } return ctx . ConditionalEntities ( iterations , c . config . GetCacheControlIteration , func ( ) error { itrMap := make ( iterationIDMap ) for _ , itr := range iterations { itrMap [ itr . ID ] = itr } wiCounts , err := appl . WorkItems ( ) . GetCountsPerIteration ( ctx , spaceID ) logrus . Info ( " " , spaceID . String ( ) , " " , wiCounts ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , err ) } res := & app . IterationList { } res . Data = ConvertIterations ( ctx . RequestData , iterations , updateIterationsWithCounts ( wiCounts ) , parentPathResolver ( itrMap ) ) return ctx . OK ( res ) } ) } ) }
List runs the list action.
List runs the list action .
// fetch extra information(counts of WI in each iteration of the space) to be added in response