// GetProvidersForUser returns a list of calendar providers associated with the given user
GetProvidersForUser returns a list of calendar providers associated with the given user
// GetProvidersForUser returns a list of calendar providers associated with the given user
func GetProvidersForUser(db *sql.DB, user *User) ([]Provider, error) {
	schools, err := GetSchoolsForUser(user)
	if err != nil {
		return nil, err
	}
	providers := []Provider{}
	for _, school := range schools {
		needsUpdate, err := school.NeedsUpdate(db)
		if err != nil {
			return nil, err
		}
		if needsUpdate {
			continue
		}
		providers = append(providers, school.CalendarProvider())
	}
	return providers, nil
}
func GetProvidersForUser ( db * sql . DB , user * User ) ( [ ] Provider , error ) { schools , err := GetSchoolsForUser ( user ) if err != nil { return nil , err } providers := [ ] Provider { } for _ , school := range schools { needsUpdate , err := school . NeedsUpdate ( db ) if err != nil { return nil , err } if needsUpdate { continue } providers = append ( providers , school . CalendarProvider ( ) ) } return providers , nil }
GetProvidersForUser returns a list of calendar providers associated with the given user
GetProvidersForUser returns a list of calendar providers associated with the given user