Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ int delegateUserId

void RemoveEnrolment(int selfAssessmentId, int delegateUserId);
(IEnumerable<SelfAssessmentDelegate>, int) GetSelfAssessmentDelegates(string searchString, int offSet, int itemsPerPage, string sortBy, string sortDirection,
int? selfAssessmentId, int centreId, bool? isDelegateActive, bool? removed, bool? submitted, bool? signedOff);
int? selfAssessmentId, int centreId, bool? isDelegateActive, bool? removed, bool? submitted, bool? signedOff, bool? started);

IEnumerable<SelfAssessmentDelegate> GetDelegatesOnSelfAssessmentForExport(int? selfAssessmentId, int centreId);

Expand Down Expand Up @@ -269,7 +269,7 @@ FROM SelfAssessments
}

public (IEnumerable<SelfAssessmentDelegate>, int) GetSelfAssessmentDelegates(string searchString, int offSet, int itemsPerPage, string sortBy, string sortDirection,
int? selfAssessmentId, int centreId, bool? isDelegateActive, bool? removed, bool? submitted, bool? signedOff)
int? selfAssessmentId, int centreId, bool? isDelegateActive, bool? removed, bool? submitted, bool? signedOff, bool? started)
{
searchString = searchString == null ? string.Empty : searchString.Trim();

Expand Down Expand Up @@ -326,6 +326,7 @@ LEFT JOIN dbo.CandidateAssessmentSupervisorVerifications AS casv WITH (NOLOCK) O
AND ((@isDelegateActive IS NULL) OR (@isDelegateActive = 1 AND (da.Active = 1)) OR (@isDelegateActive = 0 AND (da.Active = 0)))
AND ((@removed IS NULL) OR (@removed = 1 AND (ca.RemovedDate IS NOT NULL)) OR (@removed = 0 AND (ca.RemovedDate IS NULL)))
AND ((@submitted IS NULL) OR (@submitted = 1 AND (ca.SubmittedDate IS NOT NULL)) OR (@submitted = 0 AND (ca.SubmittedDate IS NULL)))
AND ((@started IS NULL) OR (@started = 1 AND (ca.LaunchCount >= 1)) OR (@started = 0 AND (ca.LaunchCount = 0)))
AND COALESCE(ucd.Email, u.PrimaryEmail) LIKE '%_@_%' ";

var groupBy = $@" GROUP BY
Expand Down Expand Up @@ -393,7 +394,8 @@ LEFT JOIN dbo.CandidateAssessmentSupervisorVerifications AS casv WITH (NOLOCK) O
isDelegateActive,
removed,
submitted,
signedOff
signedOff,
started
},
commandTimeout: 3000
);
Expand All @@ -415,7 +417,8 @@ LEFT JOIN dbo.CandidateAssessmentSupervisorVerifications AS casv WITH (NOLOCK) O
isDelegateActive,
removed,
submitted,
signedOff
signedOff,
started
},
commandTimeout: 3000
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void Index_shows_index_page_when_no_selfAssessmentId_supplied()
var selfAssessmentDelegate = new SelfAssessmentDelegate(6, "Lname");

A.CallTo(() => selfAssessmentDelegatesService.GetSelfAssessmentDelegatesPerPage("", 0, 10, "SearchableName", "Ascending",
6, UserCentreId, null, null, null, null, null))
6, UserCentreId, null, null, null, null, null, null))
.Returns((new SelfAssessmentDelegatesData(
new List<SelfAssessmentDelegate> { selfAssessmentDelegate }
), 1)
Expand Down Expand Up @@ -137,7 +137,7 @@ public void SelfAssessmentDelegates_Index_returns_ViewResult_with_EmptyDelegates
var selfAssessmentDelegate = new SelfAssessmentDelegate(6, "Lname");

A.CallTo(() => selfAssessmentDelegatesService.GetSelfAssessmentDelegatesPerPage("", 0, 10, "SearchableName", "Ascending",
10, UserCentreId, null, null, null, null, null))
10, UserCentreId, null, null, null, null, null, null))
.Returns((new SelfAssessmentDelegatesData(
new List<SelfAssessmentDelegate> { selfAssessmentDelegate }
), 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ public IActionResult Index(
var adminCategoryId = User.GetAdminCategoryId();


bool? isDelegateActive, isProgressLocked, removed, hasCompleted, submitted, signedOff;
isDelegateActive = isProgressLocked = removed = hasCompleted = submitted = signedOff = null;
bool? isDelegateActive, isProgressLocked, removed, hasCompleted, submitted, signedOff, started;
isDelegateActive = isProgressLocked = removed = hasCompleted = submitted = signedOff = started =null;

string? answer1, answer2, answer3;
answer1 = answer2 = answer3 = null;
Expand Down Expand Up @@ -181,6 +181,9 @@ public IActionResult Index(

if (filter.Contains("Answer3"))
answer3 = filterValue;

if (filter.Contains("LearnerActivity"))
started = filterValue;
}
}
}
Expand Down Expand Up @@ -211,7 +214,7 @@ public IActionResult Index(
else
{
(selfAssessmentDelegatesData, resultCount) = selfAssessmentService.GetSelfAssessmentDelegatesPerPage(searchString ?? string.Empty, offSet, itemsPerPage ?? 0, sortBy, sortDirection,
selfAssessmentId, centreId, isDelegateActive, removed, submitted, signedOff, adminCategoryId);
selfAssessmentId, centreId, isDelegateActive, removed, submitted, signedOff, adminCategoryId, started);

if (selfAssessmentDelegatesData?.Delegates == null && resultCount == null)
{
Expand All @@ -223,7 +226,7 @@ public IActionResult Index(
{
page = 1; offSet = 0;
(selfAssessmentDelegatesData, resultCount) = selfAssessmentService.GetSelfAssessmentDelegatesPerPage(searchString ?? string.Empty, offSet, itemsPerPage ?? 0, sortBy, sortDirection,
selfAssessmentId, centreId, isDelegateActive, removed, submitted, signedOff, adminCategoryId);
selfAssessmentId, centreId, isDelegateActive, removed, submitted, signedOff, adminCategoryId, started);
}

var adminId = User.GetCustomClaimAsRequiredInt(CustomClaimTypes.UserAdminId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,20 @@ public static class SelfAssessmentSignedOffFilterOptions
FilterStatus.Default
);
}
public static class SelfAssessmentLearnerActivityFilterOptions
{
private const string Group = "LearnerActivity";

public static readonly FilterOptionModel Started = new FilterOptionModel(
"Started",
FilteringHelper.BuildFilterValueString(Group, nameof(SelfAssessmentDelegate.LaunchCount), "true"),
FilterStatus.Success
);

public static readonly FilterOptionModel NotStarted = new FilterOptionModel(
"Not started",
FilteringHelper.BuildFilterValueString(Group, nameof(SelfAssessmentDelegate.LaunchCount), "false"),
FilterStatus.Default
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int delegateUserId

void RemoveEnrolment(int selfAssessmentId, int delegateUserId);
public (SelfAssessmentDelegatesData, int?) GetSelfAssessmentDelegatesPerPage(string searchString, int offSet, int itemsPerPage, string sortBy, string sortDirection,
int? selfAssessmentId, int centreId, bool? isDelegateActive, bool? removed, bool? submitted, bool? signedOff, int? adminCategoryId);
int? selfAssessmentId, int centreId, bool? isDelegateActive, bool? removed, bool? submitted, bool? signedOff, int? adminCategoryId, bool? started);
public SelfAssessmentDelegatesData GetSelfAssessmentActivityDelegatesExport(string searchString, int itemsPerPage, string sortBy, string sortDirection,
int? selfAssessmentId, int centreId, bool? isDelegateActive, bool? removed, int currentRun, bool? submitted, bool? signedOff);
public int GetSelfAssessmentActivityDelegatesExportCount(string searchString, string sortBy, string sortDirection,
Expand Down Expand Up @@ -480,7 +480,7 @@ public void RemoveEnrolment(int selfAssessmentId, int delegateUserId)
}

public (SelfAssessmentDelegatesData, int?) GetSelfAssessmentDelegatesPerPage(string searchString, int offSet, int itemsPerPage, string sortBy, string sortDirection,
int? selfAssessmentId, int centreId, bool? isDelegateActive, bool? removed, bool? submitted, bool? signedOff, int? adminCategoryId)
int? selfAssessmentId, int centreId, bool? isDelegateActive, bool? removed, bool? submitted, bool? signedOff, int? adminCategoryId, bool? started)
{

var selfAssessmentCategoryId = selfAssessmentDataService.GetSelfAssessmentCategoryId((int)selfAssessmentId);
Expand All @@ -492,7 +492,7 @@ public void RemoveEnrolment(int selfAssessmentId, int delegateUserId)
}

(var delegateselfAssessments, int resultCount) = selfAssessmentDataService.GetSelfAssessmentDelegates(searchString, offSet, itemsPerPage, sortBy, sortDirection,
selfAssessmentId, centreId, isDelegateActive, removed, submitted, signedOff);
selfAssessmentId, centreId, isDelegateActive, removed, submitted, signedOff, started);

List<SelfAssessmentDelegate> selfAssessmentDelegateList = new List<SelfAssessmentDelegate>();
foreach (var delegateInfo in delegateselfAssessments)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public class SelfAssessmentDelegateViewModelFilterOptions
SelfAssessmentSignedOffFilterOptions.SignedOff,
SelfAssessmentSignedOffFilterOptions.NotSignedOff,
};
public static readonly IEnumerable<FilterOptionModel> LearnerActivityStatusOptions = new[]
{
SelfAssessmentLearnerActivityFilterOptions.Started,
SelfAssessmentLearnerActivityFilterOptions.NotStarted,
};

public static List<FilterModel> GetAllSelfAssessmentDelegatesFilterViewModels()
{
Expand All @@ -38,6 +43,7 @@ public static List<FilterModel> GetAllSelfAssessmentDelegatesFilterViewModels()
new FilterModel("RemovedStatus", "Removed status", RemovedStatusOptions, "status"),
new FilterModel("SubmittedStatus", "Submitted status", SubmittedStatusOptions,"status"),
new FilterModel("SignedOffStatus", "Signed off status", SignedOffStatusOptions, "status"),
new FilterModel("LearnerActivityStatus", "Learner activity status", LearnerActivityStatusOptions, "status"),
};
return filters;
}
Expand Down
Loading