Skip to content

Commit

Permalink
Updated ScrumReportDetailsAsync to fetch scrum of the given project f…
Browse files Browse the repository at this point in the history
…or the given date.

Updated AssignAnswersAsync to take scrum answers of the given scrum date. Fixes#151.
  • Loading branch information
julie authored and julie committed Feb 9, 2017
1 parent 9b3f8fd commit 68c9fb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Expand Up @@ -7,6 +7,7 @@
using System.Linq;
using System.Threading.Tasks;
using Promact.Core.Repository.OauthCallsRepository;
using System.Data.Entity;

namespace Promact.Core.Repository.ScrumReportRepository
{
Expand Down Expand Up @@ -79,14 +80,14 @@ private async Task<EmployeeScrumDetails> AssignAnswersAsync(Scrum scrum, DateTim
{
EmployeeScrumDetails employeeScrumDetail = new EmployeeScrumDetails();
//Fetch all the scrum answers for a particular employee
List<ScrumAnswer> scrumAnswers = (await _scrumAnswerDataRepository.FetchAsync(x => x.EmployeeId == user.Id)).ToList();
List<ScrumAnswer> scrumAnswers = (await _scrumAnswerDataRepository.FetchAsync(x => x.EmployeeId == user.Id && DbFunctions.TruncateTime(x.AnswerDate) == scrumDate)).ToList();
//Find scrum answers for a particular employee of a particular project on a specific date
List<ScrumAnswer> todayScrumAnswers = scrumAnswers.FindAll(x => x.AnswerDate.Date == scrumDate.Date && x.ScrumId == scrum.Id).ToList();
List<ScrumAnswer> todayScrumAnswers = scrumAnswers.FindAll(x => x.ScrumId == scrum.Id).ToList();
employeeScrumDetail.EmployeeName = string.Format("{0} {1}", user.FirstName, user.LastName);
//Assigning answers to specific scrum questions
if (!todayScrumAnswers.Any())
{
employeeScrumDetail.Status = _stringConstant.PersonNotAvailable;
employeeScrumDetail.Status = string.Format(_stringConstant.PersonNotAvailable, scrumDate.ToString(_stringConstant.FormatForDate));
}
foreach (var todayScrumAnswer in todayScrumAnswers)
{
Expand Down Expand Up @@ -182,7 +183,7 @@ public async Task<ScrumProjectDetails> ScrumReportDetailsAsync(int projectId, Da
//Getting details of the specific project from Oauth server
ProjectAc project = await _oauthCallsRepository.GetProjectDetailsAsync(projectId, accessToken);
//Getting scrum for a specific project
Scrum scrum = await _scrumDataRepository.FirstOrDefaultAsync(x => x.ProjectId == project.Id);
Scrum scrum = await _scrumDataRepository.FirstOrDefaultAsync(x => x.ProjectId == project.Id && DbFunctions.TruncateTime(x.ScrumDate) == scrumDate);
ScrumProjectDetails scrumProjectDetail = new ScrumProjectDetails();
scrumProjectDetail.ScrumDate = scrumDate.ToString(_stringConstant.FormatForDate);
scrumProjectDetail.ProjectCreationDate = project.CreatedDate;
Expand Down
Expand Up @@ -2281,7 +2281,7 @@ public string PersonNotAvailable
{
get
{
return "Person Not Available";
return "Person Not Available on {0}";
}
}
public string FormatForDate
Expand Down

0 comments on commit 68c9fb2

Please sign in to comment.