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