Skip to content

Commit f11e883

Browse files
authored
Merge pull request #2886 from TechnologyEnhancedLearning/Release-2024.38
Release 2024.38
2 parents 59d481c + dbeeb42 commit f11e883

File tree

117 files changed

+2436
-1012
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+2436
-1012
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+

2+
3+
namespace DigitalLearningSolutions.Data.Migrations
4+
{
5+
using FluentMigrator;
6+
7+
[Migration(202409051645)]
8+
public class Alter_GetCompletedCoursesForCandidate_CourseActive : Migration
9+
{
10+
public override void Up()
11+
{
12+
Execute.Sql(Properties.Resources.TD_4634_Alter_GetCompletedCoursesForCandidate_UP);
13+
}
14+
public override void Down()
15+
{
16+
Execute.Sql(Properties.Resources.TD_4634_Alter_GetCompletedCoursesForCandidate_DOWN);
17+
}
18+
}
19+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+

2+
namespace DigitalLearningSolutions.Data.Migrations
3+
{
4+
using FluentMigrator;
5+
6+
[Migration(202409110900)]
7+
public class AddGroupOptionalCompetenciesToSelfAssessmentStructureTable : Migration
8+
{
9+
public override void Up()
10+
{
11+
Alter.Table("SelfAssessmentStructure")
12+
.AddColumn("GroupOptionalCompetencies")
13+
.AsCustom("BIT")
14+
.NotNullable()
15+
.WithDefaultValue(0);
16+
}
17+
18+
public override void Down()
19+
{
20+
Delete.Column("GroupOptionalCompetencies").FromTable("SelfAssessmentStructure");
21+
}
22+
}
23+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace DigitalLearningSolutions.Data.Migrations
2+
{
3+
using FluentMigrator;
4+
5+
[Migration(202409300912)]
6+
public class AlterConstraintForCandidateAssessmentsAddUtcDate : Migration
7+
{
8+
public override void Up()
9+
{
10+
Execute.Sql(@$"ALTER TABLE [dbo].[CandidateAssessments] DROP CONSTRAINT [DF_CandidateAssessments_StartedDate];
11+
ALTER TABLE [dbo].[CandidateAssessments] ADD CONSTRAINT [DF_CandidateAssessments_StartedDate] DEFAULT (GETUTCDATE()) FOR [StartedDate];");
12+
}
13+
public override void Down()
14+
{
15+
Execute.Sql(@$"ALTER TABLE [dbo].[CandidateAssessments] DROP CONSTRAINT [DF_CandidateAssessments_StartedDate];
16+
ALTER TABLE [dbo].[CandidateAssessments] ADD CONSTRAINT [DF_CandidateAssessments_StartedDate] DEFAULT (GETDATE()) FOR [StartedDate];");
17+
}
18+
19+
}
20+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+

2+
namespace DigitalLearningSolutions.Data.Migrations
3+
{
4+
using FluentMigrator;
5+
6+
[Migration(202401081132)]
7+
public class AddMinimumOptionalCompetenciesToSelfAssessmentsTable : Migration
8+
{
9+
public override void Up()
10+
{
11+
Alter.Table("SelfAssessments").AddColumn("MinimumOptionalCompetencies").AsInt32().NotNullable().WithDefaultValue(0);
12+
}
13+
14+
public override void Down()
15+
{
16+
Delete.Column("MinimumOptionalCompetencies").FromTable("SelfAssessments");
17+
}
18+
}
19+
}

DigitalLearningSolutions.Data.Migrations/Properties/Resources.Designer.cs

Lines changed: 60 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DigitalLearningSolutions.Data.Migrations/Properties/Resources.resx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,4 +442,10 @@
442442
<data name="TD_4436_Alter_uspCreateProgressRecordWithCompleteWithinMonths_Quiet_V2_Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
443443
<value>..\Scripts\TD-4436-Alter_uspCreateProgressRecordWithCompleteWithinMonths_Quiet_V2_Up.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
444444
</data>
445-
</root>
445+
<data name="TD_4634_Alter_GetCompletedCoursesForCandidate_DOWN" type="System.Resources.ResXFileRef, System.Windows.Forms">
446+
<value>..\Scripts\TD_4634_Alter_GetCompletedCoursesForCandidate_DOWN.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
447+
</data>
448+
<data name="TD_4634_Alter_GetCompletedCoursesForCandidate_UP" type="System.Resources.ResXFileRef, System.Windows.Forms">
449+
<value>..\Scripts\TD_4634_Alter_GetCompletedCoursesForCandidate_UP.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
450+
</data>
451+
</root>

DigitalLearningSolutions.Data/DataServices/ActivityDataService.cs

Lines changed: 117 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,24 @@ IEnumerable<ActivityLog> GetFilteredActivity(
1616
int? courseCategoryId,
1717
int? customisationId
1818
);
19-
19+
int GetActivityDetailRowCount(
20+
int centreId,
21+
DateTime startDate,
22+
DateTime? endDate,
23+
int? jobGroupId,
24+
int? courseCategoryId,
25+
int? customisationId
26+
);
27+
IEnumerable<ActivityLogDetail> GetFilteredActivityDetail(
28+
int centreId,
29+
DateTime startDate,
30+
DateTime? endDate,
31+
int? jobGroupId,
32+
int? courseCategoryId,
33+
int? customisationId,
34+
int exportQueryRowLimit,
35+
int currentRun
36+
);
2037
DateTime? GetStartOfActivityForCentre(int centreId, int? courseCategoryId = null);
2138
}
2239

@@ -47,10 +64,10 @@ public IEnumerable<ActivityLog> GetFilteredActivity(
4764
SUM(CAST(Registered AS Int)) AS Registered,
4865
SUM(CAST(Completed AS Int)) AS Completed,
4966
SUM(CAST(Evaluated AS Int)) AS Evaluated
50-
FROM tActivityLog AS al
67+
FROM tActivityLog AS al INNER JOIN DelegateAccounts AS da ON al.CandidateID = da.ID AND al.CentreID = da.CentreID
5168
WHERE (LogDate >= @startDate
5269
AND (@endDate IS NULL OR LogDate <= @endDate)
53-
AND CentreID = @centreId
70+
AND (al.CentreID = @centreId)
5471
AND (@jobGroupId IS NULL OR JobGroupID = @jobGroupId)
5572
AND (@customisationId IS NULL OR al.CustomisationID = @customisationId)
5673
AND (@courseCategoryId IS NULL OR al.CourseCategoryId = @courseCategoryId)
@@ -74,7 +91,103 @@ GROUP BY Cast(LogDate As Date), LogYear,
7491
}
7592
);
7693
}
77-
94+
public int GetActivityDetailRowCount(
95+
int centreId,
96+
DateTime startDate,
97+
DateTime? endDate,
98+
int? jobGroupId,
99+
int? courseCategoryId,
100+
int? customisationId
101+
)
102+
{
103+
return connection.QuerySingleOrDefault<int>(
104+
@"SELECT COUNT(1) FROM
105+
tActivityLog AS al INNER JOIN DelegateAccounts AS da ON al.CandidateID = da.ID AND al.CentreID = da.CentreID
106+
WHERE(al.LogDate >= @startDate) AND(@endDate IS NULL OR
107+
al.LogDate <= @endDate) AND(al.CentreID = @centreId) AND (@jobGroupId IS NULL OR
108+
al.JobGroupID = @jobGroupId) AND(@customisationId IS NULL OR
109+
al.CustomisationID = @customisationId) AND(@courseCategoryId IS NULL OR
110+
al.CourseCategoryID = @courseCategoryId) AND(al.Registered = 1 OR
111+
al.Completed = 1 OR
112+
al.Evaluated = 1) AND EXISTS
113+
(SELECT ApplicationID
114+
FROM Applications AS ap
115+
WHERE (ApplicationID = al.ApplicationID) AND
116+
(DefaultContentTypeID<> 4))",
117+
new
118+
{
119+
centreId,
120+
startDate,
121+
endDate,
122+
jobGroupId,
123+
customisationId,
124+
courseCategoryId
125+
}
126+
);
127+
}
128+
public IEnumerable<ActivityLogDetail> GetFilteredActivityDetail(
129+
int centreId,
130+
DateTime startDate,
131+
DateTime? endDate,
132+
int? jobGroupId,
133+
int? courseCategoryId,
134+
int? customisationId,
135+
int exportQueryRowLimit,
136+
int currentRun
137+
)
138+
{
139+
return connection.Query<ActivityLogDetail>(
140+
@"SELECT al.LogID,
141+
al.LogDate,
142+
a.ApplicationName AS CourseName,
143+
c.CustomisationName,
144+
u.FirstName,
145+
u.LastName,
146+
COALESCE(ucd.Email, u.PrimaryEmail) AS EmailAddress,
147+
da.CandidateNumber AS DelegateId,
148+
da.Answer1,
149+
da.Answer2,
150+
da.Answer3,
151+
da.Answer4,
152+
da.Answer5,
153+
da.Answer6,
154+
al.Registered AS Enrolled,
155+
al.Completed,
156+
al.Evaluated
157+
FROM Applications AS a INNER JOIN
158+
tActivityLog AS al ON a.ApplicationID = al.ApplicationID INNER JOIN
159+
Users AS u INNER JOIN
160+
DelegateAccounts AS da ON u.ID = da.UserID ON al.CandidateID = da.ID AND al.CentreID = da.CentreID INNER JOIN
161+
Customisations AS c ON al.CustomisationID = c.CustomisationID LEFT OUTER JOIN
162+
UserCentreDetails AS ucd ON u.ID = ucd.UserID AND c.CentreID = al.CentreID
163+
WHERE (al.LogDate >= @startDate) AND (@endDate IS NULL OR
164+
al.LogDate <= @endDate) AND (al.CentreID = @centreId) AND (@jobGroupId IS NULL OR
165+
al.JobGroupID = @jobGroupId) AND (@customisationId IS NULL OR
166+
al.CustomisationID = @customisationId) AND (@courseCategoryId IS NULL OR
167+
al.CourseCategoryID = @courseCategoryId) AND (al.Registered = 1 OR
168+
al.Completed = 1 OR
169+
al.Evaluated = 1) AND
170+
(u.PrimaryEmail like '%_@_%' OR ucd.Email IS NOT NULL) AND EXISTS
171+
(SELECT ApplicationID
172+
FROM Applications AS ap
173+
WHERE (ApplicationID = al.ApplicationID) AND (DefaultContentTypeID <> 4))
174+
ORDER BY al.LogDate DESC
175+
OFFSET @exportQueryRowLimit * (@currentRun - 1) ROWS
176+
FETCH NEXT @exportQueryRowLimit ROWS ONLY"
177+
,
178+
new
179+
{
180+
centreId,
181+
startDate,
182+
endDate,
183+
jobGroupId,
184+
customisationId,
185+
courseCategoryId,
186+
exportQueryRowLimit,
187+
currentRun
188+
}
189+
);
190+
}
78191
public DateTime? GetStartOfActivityForCentre(int centreId, int? courseCategoryId = null)
79192
{
80193
return connection.QuerySingleOrDefault<DateTime?>(

0 commit comments

Comments
 (0)