Skip to content

Commit 1bf82dd

Browse files
committed
refactor: deleteunused variables, await with async calls
1 parent 354712a commit 1bf82dd

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

HwProj.APIGateway/HwProj.APIGateway.API/Filters/CourseMentorOrSolutionStudentAttribute.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ public override async Task OnActionExecutionAsync(ActionExecutingContext context
4949

5050
if (courseUnitType == "Solution")
5151
{
52-
string? studentId = null;
53-
54-
HashSet<string> studentIds = [];
52+
var studentIds = new HashSet<string>();
5553
if (courseId != -1)
5654
{
5755
var solution = await _solutionsServiceClient.GetSolutionById(courseUnitId);

HwProj.APIGateway/HwProj.APIGateway.API/Filters/SolutionPrivacyAttribute.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
namespace HwProj.APIGateway.API.Filters;
12
using System.Collections.Generic;
23
using System.Linq;
34
using System.Threading.Tasks;
@@ -9,8 +10,6 @@
910
using Microsoft.AspNetCore.Mvc;
1011
using Microsoft.AspNetCore.Mvc.Filters;
1112

12-
namespace HwProj.APIGateway.API.Filters;
13-
1413
public class SolutionPrivacyAttribute : ActionFilterAttribute
1514
{
1615
private readonly ICoursesServiceClient _coursesServiceClient;
@@ -62,11 +61,11 @@ public override async Task OnActionExecutionAsync(ActionExecutingContext context
6261
courseUnitId = fileScopeDto.CourseUnitId;
6362
}
6463

65-
if (courseUnitType == "Homework") next.Invoke();
64+
if (courseUnitType == "Homework") await next.Invoke();
6665

6766
if (userRole == Roles.StudentRole)
6867
{
69-
HashSet<string> studentIds = [];
68+
var studentIds = new HashSet<string>();
7069
if (courseId != -1)
7170
{
7271
var solution = await _solutionsServiceClient.GetSolutionById(courseUnitId);

0 commit comments

Comments
 (0)