Skip to content
Snippets Groups Projects
Commit 3a5c764a authored by Lucca Santangelo Dodera's avatar Lucca Santangelo Dodera
Browse files

Merge branch 'feature/fix-closeRecord' into 'develop'

fix close record

See merge request !50
parents ae1e211f 4439691f
No related branches found
No related tags found
1 merge request!50fix close record
Pipeline #10676 passed
...@@ -305,7 +305,7 @@ namespace Tsi1.Api.Controllers ...@@ -305,7 +305,7 @@ namespace Tsi1.Api.Controllers
return Ok(result.Data); return Ok(result.Data);
} }
[Authorize(Roles = UserTypes.Professor)] [Authorize(Roles = UserTypes.FacultyAdmin)]
[HttpPost("CloseRecord/{courseId}")] [HttpPost("CloseRecord/{courseId}")]
public async Task<IActionResult> CloseRecord(int courseId) public async Task<IActionResult> CloseRecord(int courseId)
{ {
...@@ -317,7 +317,7 @@ namespace Tsi1.Api.Controllers ...@@ -317,7 +317,7 @@ namespace Tsi1.Api.Controllers
return BadRequest(courseResult.Message); return BadRequest(courseResult.Message);
} }
var studentCourseResult = await _studentCourseResultService.GetLastStudentCourseResults(courseId, userId); var studentCourseResult = await _studentCourseResultService.GetLastStudentCourseResults(courseId, userId, false);
if (studentCourseResult.HasError) if (studentCourseResult.HasError)
{ {
return BadRequest(studentCourseResult.Message); return BadRequest(studentCourseResult.Message);
......
...@@ -17,7 +17,7 @@ namespace Tsi1.BusinessLayer.Interfaces ...@@ -17,7 +17,7 @@ namespace Tsi1.BusinessLayer.Interfaces
Task<ServiceResult<StudentCourseResultPreviewDto>> GetMyLastResult(int courseId, int userId); Task<ServiceResult<StudentCourseResultPreviewDto>> GetMyLastResult(int courseId, int userId);
Task<ServiceResult<List<StudentCourseResultPreviewDto>>> GetLastStudentCourseResults(int courseId, int userId); Task<ServiceResult<List<StudentCourseResultPreviewDto>>> GetLastStudentCourseResults(int courseId, int userId, bool isProfessor = true);
Task<ServiceResult<List<StudentCourseResultQuantityDto>>> GetAllLastStudentCourseResults(int tenantId); Task<ServiceResult<List<StudentCourseResultQuantityDto>>> GetAllLastStudentCourseResults(int tenantId);
} }
} }
...@@ -99,17 +99,20 @@ namespace Tsi1.BusinessLayer.Services ...@@ -99,17 +99,20 @@ namespace Tsi1.BusinessLayer.Services
return result; return result;
} }
public async Task<ServiceResult<List<StudentCourseResultPreviewDto>>> GetLastStudentCourseResults(int courseId, int userId) public async Task<ServiceResult<List<StudentCourseResultPreviewDto>>> GetLastStudentCourseResults(int courseId, int userId, bool isProfessor = true)
{ {
var result = new ServiceResult<List<StudentCourseResultPreviewDto>>(); var result = new ServiceResult<List<StudentCourseResultPreviewDto>>();
var professorValidation = await this.ProfessorValidations(courseId, userId); if (isProfessor)
if (professorValidation.HasError)
{ {
result.HasError = true; var professorValidation = await this.ProfessorValidations(courseId, userId);
result.AddMessage(professorValidation.Message);
return result; if (professorValidation.HasError)
{
result.HasError = true;
result.AddMessage(professorValidation.Message);
return result;
}
} }
var studentIds = await _context.StudentCourses var studentIds = await _context.StudentCourses
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment