Skip to content

Commit af13dee

Browse files
committed
TD3838 Reworks query to use coalesce to avoid throwing exception
1 parent e002c48 commit af13dee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

DigitalLearningSolutions.Data/DataServices/CourseContentService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,18 +270,18 @@ FROM Sessions AS S1 WITH (NOLOCK)
270270
try
271271
{
272272
return connection.QueryFirst<int>(
273-
@"SELECT ProgressId
274-
FROM Progress
273+
@"SELECT COALESCE((SELECT ProgressID
274+
FROM Progress
275275
WHERE CandidateID = @candidateId
276276
AND CustomisationID = @customisationId
277277
AND SystemRefreshed = 0
278-
AND RemovedDate IS NULL",
278+
AND RemovedDate IS NULL), 0) AS ProgressId",
279279
new { candidateId, customisationId }
280280
);
281281
}
282282
catch (InvalidOperationException)
283283
{
284-
return null;
284+
return 0;
285285
}
286286
}
287287
}

0 commit comments

Comments
 (0)