Skip to content

Commit

Permalink
CON-997 Renamed properties per PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
indiwiz committed Nov 5, 2019
1 parent 795f1c2 commit b1b6d9d
Show file tree
Hide file tree
Showing 26 changed files with 39 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task MapFromVacancyAsync(DisplayVacancyViewModel vm, Vacancy vacanc
vm.CanSubmit = vacancy.CanSubmit;
vm.ClosingDate = (vacancy.ClosedDate ?? vacancy.ClosingDate)?.AsGdsDate();
vm.EducationLevelName =
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.Level);
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.ApprenticeshipLevel);
vm.EmployerContactName = vacancy.EmployerContact?.Name;
vm.EmployerContactEmail = vacancy.EmployerContact?.Email;
vm.EmployerContactTelephone = vacancy.EmployerContact?.Phone;
Expand Down Expand Up @@ -89,7 +89,7 @@ public async Task MapFromVacancyAsync(DisplayVacancyViewModel vm, Vacancy vacanc
{
vm.TrainingTitle = programme?.Title;
vm.TrainingType = programme?.ApprenticeshipType.GetDisplayName();
vm.TrainingLevel = programme?.Level.GetDisplayName();
vm.TrainingLevel = programme?.ApprenticeshipLevel.GetDisplayName();
}

if (vacancy.Wage != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private async Task SetTrainingProgrammeAsync(Vacancy vacancy, DatesViewModel vm)

if (programme?.EffectiveTo.HasValue == true)
{
vm.TrainingDescription = $"{programme.Title}, Level:{(int)programme.Level}";
vm.TrainingDescription = $"{programme.Title}, Level:{(int)programme.ApprenticeshipLevel}";
vm.TrainingEffectiveToDate = programme.EffectiveTo.Value.AsGdsDate();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ public async Task<ConfirmTrainingViewModel> GetConfirmTrainingViewModelAsync(Vac
return new ConfirmTrainingViewModel
{
ProgrammeId = programme.Id,
Level = programme.Level,
ApprenticeshipLevel = programme.ApprenticeshipLevel,
TrainingTitle = programme.Title,
DurationMonths = programme.Duration,
ProgrammeType = programme.ApprenticeshipType.GetDisplayName(),
PageInfo = Utility.GetPartOnePageInfo(vacancyTask.Result),
TrainingEffectiveToDate = programme.EffectiveTo?.AsGdsDate(),
EducationLevelName =
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.Level)
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.ApprenticeshipLevel)
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public async Task<VacancyPreviewViewModel> GetVacancyPreviewViewModelAsync(Vacan
vm.CanShowDraftHeader = vacancy.Status == VacancyStatus.Draft;
vm.SoftValidationErrors = GetSoftValidationErrors(vacancy);
vm.EducationLevelName =
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.Level);
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.ApprenticeshipLevel);

if (programme != null) vm.Level = programme.Level;
if (programme != null) vm.ApprenticeshipLevel = programme.ApprenticeshipLevel;

if (vacancy.Status == VacancyStatus.Referred)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@ public async Task<DisplayVacancyViewModel> GetFullVacancyDisplayViewModelAsync(V
case VacancyStatus.Approved:
var approvedViewModel = new ApprovedVacancyViewModel();
approvedViewModel.EducationLevelName =
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.Level);
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.ApprenticeshipLevel);
await _vacancyDisplayMapper.MapFromVacancyAsync(approvedViewModel, vacancy);
approvedViewModel.ApprovedDate = vacancy.ApprovedDate.Value.AsGdsDate();
return approvedViewModel;
case VacancyStatus.Live:
var liveViewModel = new LiveVacancyViewModel();
liveViewModel.EducationLevelName =
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.Level);
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.ApprenticeshipLevel);
await _vacancyDisplayMapper.MapFromVacancyAsync(liveViewModel, vacancy);
return liveViewModel;
case VacancyStatus.Closed:
case VacancyStatus.Closed:
var closedViewModel = new ClosedVacancyViewModel();
closedViewModel.EducationLevelName =
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.Level);
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.ApprenticeshipLevel);
await _vacancyDisplayMapper.MapFromVacancyAsync(closedViewModel, vacancy);
return closedViewModel;
case VacancyStatus.Submitted:
var submittedViewModel = new SubmittedVacancyViewModel();
submittedViewModel.EducationLevelName =
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.Level);
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.ApprenticeshipLevel);
await _vacancyDisplayMapper.MapFromVacancyAsync(submittedViewModel, vacancy);
submittedViewModel.SubmittedDate = vacancy.SubmittedDate.Value.AsGdsDate();
return submittedViewModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Esfa.Recruit.Employer.Web.ViewModels.Part1.Training
public class ConfirmTrainingViewModel
{
public string TrainingTitle { get; set; }
public ApprenticeshipLevel Level { get; set; }
public ApprenticeshipLevel ApprenticeshipLevel { get; set; }
public int DurationMonths { get; set; }
public string ProgrammeType {get; set; }
public string ProgrammeId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private bool IsEditRequired(string fieldIdentifier)
}.Count(s => s == VacancyPreviewSectionState.Incomplete || s == VacancyPreviewSectionState.InvalidIncomplete);

public string IncompleteRequiredSectionText => "section".ToQuantity(IncompleteRequiredSectionCount, ShowQuantityAs.None);
public ApprenticeshipLevel Level { get; set; }
public ApprenticeshipLevel ApprenticeshipLevel { get; set; }

public IList<string> OrderedFieldNames => new List<string>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task MapFromVacancyAsync(DisplayVacancyViewModel vm, Vacancy vacanc
vm.CanSubmit = vacancy.CanSubmit;
vm.ClosingDate = (vacancy.ClosedDate ?? vacancy.ClosingDate)?.AsGdsDate();
vm.EducationLevelName =
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.Level);
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.ApprenticeshipLevel);
vm.EmployerDescription = vacancy.EmployerDescription;
vm.EmployerName = await _vacancyClient.GetEmployerNameAsync(vacancy);
vm.EmployerWebsiteUrl = vacancy.EmployerWebsiteUrl;
Expand Down Expand Up @@ -85,7 +85,7 @@ public async Task MapFromVacancyAsync(DisplayVacancyViewModel vm, Vacancy vacanc
{
vm.TrainingTitle = programme?.Title;
vm.TrainingType = programme?.ApprenticeshipType.GetDisplayName();
vm.TrainingLevel = programme?.Level.GetDisplayName();
vm.TrainingLevel = programme?.ApprenticeshipLevel.GetDisplayName();
}

if (vacancy.Wage != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private async Task SetTrainingProgrammeAsync(Vacancy vacancy, DatesViewModel vm)

if (programme?.EffectiveTo.HasValue == true)
{
vm.TrainingDescription = $"{programme.Title}, Level:{(int) programme.Level}";
vm.TrainingDescription = $"{programme.Title}, Level:{(int) programme.ApprenticeshipLevel}";
vm.TrainingEffectiveToDate = programme.EffectiveTo.Value.AsGdsDate();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ public async Task<ConfirmTrainingViewModel> GetConfirmTrainingViewModelAsync(Vac
return new ConfirmTrainingViewModel
{
ProgrammeId = programme.Id,
Level = programme.Level,
ApprenticeshipLevel = programme.ApprenticeshipLevel,
TrainingTitle = programme.Title,
DurationMonths = programme.Duration,
ProgrammeType = programme.ApprenticeshipType.GetDisplayName(),
PageInfo = Utility.GetPartOnePageInfo(vacancyTask.Result),
TrainingEffectiveToDate = programme.EffectiveTo?.AsGdsDate(),
EducationLevelName =
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.Level)
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.ApprenticeshipLevel)
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public async Task<VacancyPreviewViewModel> GetVacancyPreviewViewModelAsync(Vacan
vm.CanShowDraftHeader = vacancy.Status == VacancyStatus.Draft;
vm.SoftValidationErrors = GetSoftValidationErrors(vacancy);

if (programme != null) vm.Level = programme.Level;
if (programme != null) vm.ApprenticeshipLevel = programme.ApprenticeshipLevel;

if (vacancy.Status == VacancyStatus.Referred)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Esfa.Recruit.Provider.Web.ViewModels.Part1.Training
public class ConfirmTrainingViewModel
{
public string TrainingTitle { get; set; }
public ApprenticeshipLevel Level { get; set; }
public ApprenticeshipLevel ApprenticeshipLevel { get; set; }
public string EducationLevelName { get; set; }
public int DurationMonths { get; set; }
public string ProgrammeType {get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public class VacancyPreviewViewModel : DisplayVacancyViewModel
public bool VacancyDescriptionRequiresEdit => IsEditRequired(FieldIdentifiers.VacancyDescription);
public bool WageRequiresEdit => IsEditRequired(FieldIdentifiers.Wage);
public bool WorkingWeekRequiresEdit => IsEditRequired(FieldIdentifiers.WorkingWeek);
public ApprenticeshipLevel Level { get; set; }
public ApprenticeshipLevel ApprenticeshipLevel { get; set; }
private bool IsEditRequired(string fieldIdentifier)
{
return Review.FieldIndicators.Any(f => f.ReviewFieldIdentifier == fieldIdentifier);
Expand Down
6 changes: 3 additions & 3 deletions src/QA/QA.Web/Mappings/ReviewMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ await Task.WhenAll(
vm.ApplicationUrl = vacancy.ApplicationUrl;
vm.ClosingDate = vacancy.ClosingDate?.AsGdsDate();
vm.EducationLevelName =
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.Level);
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.ApprenticeshipLevel);
vm.EmployerContactName = vacancy.EmployerContact?.Name;
vm.EmployerContactEmail = vacancy.EmployerContact?.Email;
vm.EmployerContactTelephone = vacancy.EmployerContact?.Phone;
Expand Down Expand Up @@ -200,8 +200,8 @@ await Task.WhenAll(
vm.VacancyReferenceNumber = $"VAC{vacancy.VacancyReference}";
vm.TrainingTitle = programme.Title;
vm.TrainingType = programme.ApprenticeshipType.GetDisplayName();
vm.TrainingLevel = programme.Level.GetDisplayName();
vm.Level = programme.Level;
vm.TrainingLevel = programme.ApprenticeshipLevel.GetDisplayName();
vm.Level = programme.ApprenticeshipLevel;
vm.ExpectedDuration = (vacancy.Wage.DurationUnit.HasValue && vacancy.Wage.Duration.HasValue)
? vacancy.Wage.DurationUnit.Value.GetDisplayName().ToQuantity(vacancy.Wage.Duration.Value)
: null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static IEnumerable<ApprenticeshipProgrammeViewModel> ToViewModel(
public static ApprenticeshipProgrammeViewModel ToViewModel(this IApprenticeshipProgramme programme)
{
string educationLevelName =
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.Level);
EducationLevelNumberHelper.GetEducationLevelNameOrDefault(programme.EducationLevelNumber, programme.ApprenticeshipLevel);

return new ApprenticeshipProgrammeViewModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ namespace Esfa.Recruit.Vacancies.Client.Domain.Entities
{
public static class ApprenticeshipLevelHelper
{
//TODO: PeteM - TryRemapFromEducationLevel
public static bool TryRemapFromInt(int value, out ApprenticeshipLevel result)
{
switch (value)
Expand All @@ -26,7 +25,6 @@ public static bool TryRemapFromInt(int value, out ApprenticeshipLevel result)
return false;
}

//TODO: PeteM - RemapFromEducationLevel
public static ApprenticeshipLevel RemapFromInt(int value)
{
if (TryRemapFromInt(value, out ApprenticeshipLevel result))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface IApprenticeshipProgramme
string Title { get; }
DateTime? EffectiveFrom { get; }
DateTime? EffectiveTo { get; }
ApprenticeshipLevel Level { get; }
ApprenticeshipLevel ApprenticeshipLevel { get; }
int Duration { get; }
bool IsActive { get; set; }
int? EducationLevelNumber { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static T ToVacancyProjectionBase<T>(this Vacancy vacancy, ApprenticeshipP
projectedVacancy.NumberOfPositions = vacancy.NumberOfPositions.GetValueOrDefault();
projectedVacancy.OutcomeDescription = vacancy.OutcomeDescription;
projectedVacancy.ProgrammeId = vacancy.ProgrammeId;
projectedVacancy.ProgrammeLevel = programme.Level.ToString();
projectedVacancy.ProgrammeLevel = programme.ApprenticeshipLevel.ToString();
projectedVacancy.ProgrammeType = programme.ApprenticeshipType.ToString();
projectedVacancy.Qualifications = vacancy.Qualifications.ToProjection();
projectedVacancy.ShortDescription = vacancy.ShortDescription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static IEnumerable<ApprenticeshipProgramme> FilterAndMapToApprenticeshipP
IsActive = IsStandardActive(x),
EffectiveFrom = x.EffectiveFrom,
EffectiveTo = x.EffectiveTo,
Level = ApprenticeshipLevelHelper.RemapFromInt(x.Level),
ApprenticeshipLevel = ApprenticeshipLevelHelper.RemapFromInt(x.Level),
EducationLevelNumber = x.Level,
Duration = x.Duration
});
Expand All @@ -40,7 +40,7 @@ public static IEnumerable<ApprenticeshipProgramme> FilterAndMapToApprenticeshipP
IsActive = IsFrameworkActive(x),
EffectiveFrom = x.EffectiveFrom,
EffectiveTo = x.EffectiveTo,
Level = ApprenticeshipLevelHelper.RemapFromInt(x.Level),
ApprenticeshipLevel = ApprenticeshipLevelHelper.RemapFromInt(x.Level),
EducationLevelNumber = x.Level,
Duration = x.Duration
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ApprenticeshipProgramme : IApprenticeshipProgramme

public DateTime? EffectiveTo { get; set; }

public ApprenticeshipLevel Level { get; set; }
public ApprenticeshipLevel ApprenticeshipLevel { get; set; }

public int Duration { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class ApprenticeshipProgrammeEqualityComparer : IEqualityComparer<Apprent
public bool Equals(ApprenticeshipProgramme x, ApprenticeshipProgramme y)
{
return x.Id.Equals(y.Id)
&& x.Level == y.Level
&& x.ApprenticeshipLevel == y.ApprenticeshipLevel
&& x.ApprenticeshipType == y.ApprenticeshipType;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private async Task UpdateWithTrainingProgrammeInfo(VacancySummary summary)
{
summary.TrainingTitle = programme.Title;
summary.TrainingType = programme.ApprenticeshipType;
summary.TrainingLevel = programme.Level;
summary.TrainingLevel = programme.ApprenticeshipLevel;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private async Task UpdateWithTrainingProgrammeInfo(VacancySummary summary)
{
summary.TrainingTitle = programme.Title;
summary.TrainingType = programme.ApprenticeshipType;
summary.TrainingLevel = programme.Level;
summary.TrainingLevel = programme.ApprenticeshipLevel;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class TestApprenticeshipProgramme : IApprenticeshipProgramme

public DateTime? EffectiveTo { get; set; }

public ApprenticeshipLevel Level { get; set; }
public ApprenticeshipLevel ApprenticeshipLevel { get; set; }

public int Duration { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class VacancyExtensionsTests
private DateTime _now = DateTime.UtcNow;
private ApprenticeshipProgramme _programme = new ApprenticeshipProgramme
{
Level = ApprenticeshipLevel.Advanced,
ApprenticeshipLevel = ApprenticeshipLevel.Advanced,
ApprenticeshipType = TrainingType.Standard,
EducationLevelNumber = 7
};
Expand Down Expand Up @@ -119,7 +119,7 @@ private void AssertCommonProperties(Vacancy v, VacancyProjectionBase p)
p.NumberOfPositions.Should().Be(v.NumberOfPositions.Value);
p.OutcomeDescription.Should().Be(v.OutcomeDescription);
p.ProgrammeId.Should().Be(v.ProgrammeId);
p.ProgrammeLevel.Should().Be(_programme.Level.ToString());
p.ProgrammeLevel.Should().Be(_programme.ApprenticeshipLevel.ToString());
p.ProgrammeType.Should().Be(_programme.ApprenticeshipType.ToString());
p.EducationLevelNumber.Should().Be(_programme.EducationLevelNumber);
p.ShortDescription.Should().Be(v.ShortDescription);
Expand Down
Loading

0 comments on commit b1b6d9d

Please sign in to comment.