Group by issue in responses
This commit is contained in:
parent
09fcae68a4
commit
59f547d49d
@ -82,7 +82,7 @@ namespace DamageAssesment.Api.Responses.Providers
|
||||
}
|
||||
listSurveyResponse = listSurveyResponse
|
||||
.OrderByDescending(obj => obj.Id)
|
||||
.GroupBy(obj => new { obj.SurveyId, obj.EmployeeId, obj.LocationId })
|
||||
.GroupBy(obj => new { obj.SurveyId, obj.LocationId })//obj.EmployeeId,
|
||||
.Select(group => group.FirstOrDefault()) // or .FirstOrDefault() if you want to handle empty groups
|
||||
.ToList();
|
||||
if (listSurveyResponse.Any())
|
||||
@ -582,7 +582,12 @@ namespace DamageAssesment.Api.Responses.Providers
|
||||
surveyResonses = await surveyResponseDbContext.SurveyResponses.Where(x => x.SurveyId == surveyId && x.EmployeeId == employeeid).ToListAsync();
|
||||
employee = await employeeServiceProvider.getEmployeeAsync(employeeid, token);
|
||||
}
|
||||
|
||||
surveyResonses = surveyResonses
|
||||
.OrderByDescending(obj => obj.Id)
|
||||
.GroupBy(obj => new { obj.SurveyId, obj.LocationId })//obj.EmployeeId,
|
||||
.Select(group => group.FirstOrDefault()) // or .FirstOrDefault() if you want to handle empty groups
|
||||
.ToList();
|
||||
|
||||
var answers = await answerServiceProvider.getAnswersAsync(token);
|
||||
var questions = await questionServiceProvider.getQuestionsAsync(null, token);
|
||||
var surveyQuestions = from q in questions where q.SurveyId == surveyId select q;
|
||||
@ -911,7 +916,11 @@ namespace DamageAssesment.Api.Responses.Providers
|
||||
_employee = new { employee.Id, employee.Name, employee.BirthDate, employee.Email, employee.OfficePhoneNumber };
|
||||
}
|
||||
}
|
||||
|
||||
surveyResonses = surveyResonses
|
||||
.OrderByDescending(obj => obj.Id)
|
||||
.GroupBy(obj => new { obj.SurveyId, obj.LocationId }) //obj.EmployeeId,
|
||||
.Select(group => group.FirstOrDefault()) // or .FirstOrDefault() if you want to handle empty groups
|
||||
.ToList();
|
||||
var answers = await answerServiceProvider.getAnswersAsync(token);
|
||||
var questions = await questionServiceProvider.getQuestionsAsync(null, token);
|
||||
var surveyQuestions = from q in questions where q.SurveyId == surveyId select q;
|
||||
@ -977,7 +986,11 @@ namespace DamageAssesment.Api.Responses.Providers
|
||||
_employee = new { employee.Id, employee.Name, employee.BirthDate, employee.Email, employee.OfficePhoneNumber };
|
||||
}
|
||||
}
|
||||
|
||||
surveyResponses = surveyResponses
|
||||
.OrderByDescending(obj => obj.Id)
|
||||
.GroupBy(obj => new { obj.SurveyId, obj.LocationId })//, obj.EmployeeId
|
||||
.Select(group => group.FirstOrDefault()) // or .FirstOrDefault() if you want to handle empty groups
|
||||
.ToList();
|
||||
//var surveyResponses = await surveyResponseDbContext.Responses.Where(x => x.SurveyId == survey.Id).ToListAsync();
|
||||
// var employees = await employeeServiceProvider.getEmployeesAsync();
|
||||
var answers = await answerServiceProvider.getAnswersAsync(token);
|
||||
|
Loading…
Reference in New Issue
Block a user