Skip to content

Commit

Permalink
VIH-10166 remove suitability answers & questionnaire (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaed-parkar authored Sep 13, 2023
1 parent 248be5f commit 03455c9
Show file tree
Hide file tree
Showing 96 changed files with 1,657 additions and 2,042 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public CreateHearingRequestBuilder(string caseName)
.With(x => x.Endpoints = endpoints)
.With(x => x.Cases = cases)
.With(x => x.CreatedBy = createdBy)
.With(x => x.QuestionnaireNotRequired = false)
.With(x => x.AudioRecordingRequired = true)
.With(x => x.Endpoints = new List<EndpointRequest> {new EndpointRequest{ DisplayName = "New Endpoint"}})
.Build();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,5 @@ public void ThenIndividualDetailsShouldBeUpdated(string participant)
model.TelephoneNumber.Should().Be(updateParticipantRequest.TelephoneNumber);
model.LinkedParticipants.Count.Should().Be(participant == "Individual" ? 1 : 0);
}

[Given(@"I have an update participant suitability answers with a valid user '(.*)'")]
public void GivenIHaveAnUpdateParticipantSuitabilityAnswersWithAValidUser(string role)
{
var participantId = _context.TestData.ParticipantsResponses.FirstOrDefault(x => x.UserRoleName.Equals(role)).Id;
var updateParticipantRequest = UpdateSuitabilityAnswersRequest.BuildRequest();
_context.TestData.Answers = updateParticipantRequest;
_context.Request = _context.Put(UpdateSuitabilityAnswers(_context.TestData.Hearing.Id, participantId), updateParticipantRequest);
}
}
}
28 changes: 0 additions & 28 deletions BookingsApi/BookingsApi.AcceptanceTests/Steps/PersonsSteps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,34 +92,6 @@ public void ThenPersonsDetailsShouldBeRetrieved()
actual.Username.Should().Be(expected.Username);
}

[Then(@"suitability answers for '(.*)' should be updated")]
public void ThenSuitabilityAnswersForShouldBeUpdated(string participant)
{
var username = _context.TestData.ParticipantsResponses
.FirstOrDefault(x => x.UserRoleName.Equals(participant)).Username;
var participantId = _context.TestData.ParticipantsResponses
.FirstOrDefault(x => x.UserRoleName.Equals(participant)).Id;
_context.Request = _context.Get(GetPersonSuitabilityAnswers(username));
_context.Response = _context.Client().Execute(_context.Request);
_context.Response.StatusCode.Should().Be(HttpStatusCode.OK);
var model =
RequestHelper.Deserialise<List<PersonSuitabilityAnswerResponse>>(
_context.Response.Content);
var expectedResult = _context.TestData.Answers;

expectedResult[0].Key.Should().Be(model[0].Answers[0].Key);
expectedResult[0].Answer.Should().Be(model[0].Answers[0].Answer);
expectedResult[0].ExtendedAnswer.Should().Be(model[0].Answers[0].ExtendedAnswer);
expectedResult[1].Key.Should().Be(model[0].Answers[1].Key);
expectedResult[1].Answer.Should().Be(model[0].Answers[1].Answer);
expectedResult[1].ExtendedAnswer.Should().Be(model[0].Answers[1].ExtendedAnswer);

model[0].HearingId.Should().Be(_context.TestData.Hearing.Id);
model[0].ParticipantId.Should().Be(participantId);
model[0].UpdatedAt.Should().BeAfter(DateTime.UtcNow.AddMinutes(-2));
model[0].QuestionnaireNotRequired.Should().BeFalse();
}

[Then(@"a list of hearings for deletion is (.*)")]
public void ThenAListOfHearingsForDeletionIs(int expectedNumOfHearings)
{
Expand Down
412 changes: 0 additions & 412 deletions BookingsApi/BookingsApi.Client/BookingsApiClient.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public BookNewHearingRequest()
/// <summary>
/// QuestionnaireNotRequired
/// </summary>
public bool QuestionnaireNotRequired { get; set; }
[Obsolete("This property is no longer used.")]
public bool QuestionnaireNotRequired { get; set; } = false;

/// <summary>
/// Gets or sets the audio recording required flag, value true is indicated that recording is required, otherwise false
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace BookingsApi.Contract.V1.Requests
{
Expand Down Expand Up @@ -43,6 +44,8 @@ public class UpdateHearingRequest
/// <summary>
/// QuestionnaireNotRequired
/// </summary>
[Obsolete("This property is no longer used.")]
[DefaultValue(false)]
public bool? QuestionnaireNotRequired { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public DateTime HearingDate
/// <summary>
/// QuestionnaireNotRequired
/// </summary>
[Obsolete("This property is no longer used.")]
public bool QuestionnaireNotRequired { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public class HearingDetailsResponse
/// <summary>
/// QuestionnaireNotRequired
/// </summary>
[Obsolete("This property is no longer used.")]
public bool QuestionnaireNotRequired { get; set; }

/// <summary>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

57 changes: 31 additions & 26 deletions BookingsApi/BookingsApi.DAL/Commands/CreateVideoHearingCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,30 @@ namespace BookingsApi.DAL.Commands
{
public class CreateVideoHearingCommand : ICommand
{
public CreateVideoHearingCommand(CaseType caseType, HearingType hearingType, DateTime scheduledDateTime,
int scheduledDuration, HearingVenue venue, List<NewParticipant> participants, List<Case> cases,
bool questionnaireNotRequired, bool audioRecordingRequired, List<NewEndpoint> endpoints,
List<LinkedParticipantDto> linkedParticipants, bool isMultiDayFirstHearing)
public CreateVideoHearingCommand(CreateVideoHearingRequiredDto requiredDto,
CreateVideoHearingOptionalDto optionalDto)
{
CaseType = caseType;
HearingType = hearingType;
ScheduledDateTime = scheduledDateTime;
ScheduledDuration = scheduledDuration;
Venue = venue;
Participants = participants;
Cases = cases;
QuestionnaireNotRequired = questionnaireNotRequired;
AudioRecordingRequired = audioRecordingRequired;
Endpoints = endpoints;
LinkedParticipants = linkedParticipants;
IsMultiDayFirstHearing = isMultiDayFirstHearing;
CaseType = requiredDto.CaseType;
HearingType = requiredDto.HearingType;
ScheduledDateTime = requiredDto.ScheduledDateTime;
ScheduledDuration = requiredDto.ScheduledDuration;
Venue = requiredDto.Venue;
Cases = requiredDto.Cases;

Participants = optionalDto.Participants ?? new List<NewParticipant>();
HearingRoomName = optionalDto.HearingRoomName;
OtherInformation = optionalDto.OtherInformation;
CreatedBy = optionalDto.CreatedBy;

AudioRecordingRequired = optionalDto.AudioRecordingRequired;
Endpoints = optionalDto.Endpoints;
CancelReason = optionalDto.CancelReason;

LinkedParticipants = optionalDto.LinkedParticipants ?? new List<LinkedParticipantDto>();
JudiciaryParticipants = optionalDto.JudiciaryParticipants ?? new List<NewJudiciaryParticipant>();
IsMultiDayFirstHearing = optionalDto.IsMultiDayFirstHearing;

SourceId = optionalDto.SourceId;
}

public Guid NewHearingId { get; set; }
Expand All @@ -33,16 +40,15 @@ public CreateVideoHearingCommand(CaseType caseType, HearingType hearingType, Dat
public HearingVenue Venue { get; }
public List<NewParticipant> Participants { get; }
public List<Case> Cases { get; }
public string HearingRoomName { get; set; }
public string OtherInformation { get; set; }
public string CreatedBy { get; set; }
public bool QuestionnaireNotRequired { get; set; }
public bool AudioRecordingRequired { get; set; }
public string HearingRoomName { get; }
public string OtherInformation { get; }
public string CreatedBy { get; }
public bool AudioRecordingRequired { get; }
public List<NewEndpoint> Endpoints { get; }
public string CancelReason { get; set; }
public Guid? SourceId { get; set; }
public string CancelReason { get; }
public Guid? SourceId { get; }
public List<LinkedParticipantDto> LinkedParticipants { get; }
public List<NewJudiciaryParticipant> JudiciaryParticipants { get; set; } = new();
public List<NewJudiciaryParticipant> JudiciaryParticipants { get; }
public bool IsMultiDayFirstHearing { get; }
}

Expand All @@ -61,8 +67,7 @@ public async Task Handle(CreateVideoHearingCommand command)
{
var videoHearing = new VideoHearing(command.CaseType, command.HearingType, command.ScheduledDateTime,
command.ScheduledDuration, command.Venue, command.HearingRoomName,
command.OtherInformation, command.CreatedBy, command.QuestionnaireNotRequired,
command.AudioRecordingRequired, command.CancelReason);
command.OtherInformation, command.CreatedBy, command.AudioRecordingRequired, command.CancelReason);

// Ideally, the domain object would implement the clone method and so this change is a work around.
videoHearing.IsFirstDayOfMultiDayHearing = command.IsMultiDayFirstHearing;
Expand Down
3 changes: 1 addition & 2 deletions BookingsApi/BookingsApi.DAL/Commands/RemoveHearingCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public async Task Handle(RemoveHearingCommand command)
var hearingsIncCloned = await _context.VideoHearings
.Include(x => x.HearingCases).ThenInclude(x => x.Case)
.Include(x => x.Participants).ThenInclude(x => x.Person).ThenInclude(x => x.Organisation)
.Include(x => x.Participants).ThenInclude(x => x.LinkedParticipants)//.ThenInclude(x => x.Participant)
.Include(x => x.Participants).ThenInclude(x => x.Questionnaire).ThenInclude(x => x.SuitabilityAnswers)
.Include(x => x.Participants).ThenInclude(x => x.LinkedParticipants)
.Include(x => x.Endpoints).ThenInclude(x => x.DefenceAdvocate)
.Include(x=> x.JudiciaryParticipants).ThenInclude(x=> x.JudiciaryPerson)
.Where(x => x.Id == command.HearingId || x.SourceId == command.HearingId).ToListAsync();
Expand Down
Loading

0 comments on commit 03455c9

Please sign in to comment.