/// <summary> /// Gets the completed achievement attempt ids. /// </summary> /// <param name="rockContext">The rock context.</param> /// <param name="attendanceRecordsPersonAliasIds">The attendance records person alias ids.</param> /// <param name="configuredAchievementTypeIds">The configured achievement type ids.</param> /// <returns></returns> private AchievementAttemptService.AchievementAttemptWithPersonAlias[] GetSuccessfullyCompletedAchievementAttempts(RockContext rockContext, int[] attendanceRecordsPersonAliasIds, List <int> configuredAchievementTypeIds) { var achievementAttemptService = new AchievementAttemptService(new RockContext()); var completedAchievementAttempts = achievementAttemptService.GetAchievementAttemptWithAchieverPersonAliasQuery() .Where(x => attendanceRecordsPersonAliasIds.Contains(x.AchieverPersonAlias.Id)) .Where(a => configuredAchievementTypeIds.Contains(a.AchievementAttempt.AchievementTypeId)) .Where(a => a.AchievementAttempt.IsSuccessful || a.AchievementAttempt.IsClosed) .AsNoTracking() .ToArray(); return(completedAchievementAttempts); }
/// <summary> /// Gets the achievement attempts with person alias query. /// </summary> /// <param name="rockContext">The rock context.</param> /// <param name="attendanceRecordsPersonAliasIds">The attendance records person alias ids.</param> /// <param name="configuredAchievementTypeIds">The configured achievement type ids.</param> /// <returns></returns> private IQueryable <AchievementAttemptService.AchievementAttemptWithPersonAlias> GetAchievementAttemptsWithPersonAliasQuery(RockContext rockContext, int[] attendanceRecordsPersonAliasIds, List <int> configuredAchievementTypeIds) { var achievementAttemptService = new AchievementAttemptService(new RockContext()); IQueryable <AchievementAttemptService.AchievementAttemptWithPersonAlias> achievementAttemptsQuery = achievementAttemptService.GetAchievementAttemptWithAchieverPersonAliasQuery() .Where(a => configuredAchievementTypeIds.Contains(a.AchievementAttempt.AchievementTypeId) && attendanceRecordsPersonAliasIds.Contains(a.AchieverPersonAlias.Id)); return(achievementAttemptsQuery); }