Skip to content

Commit

Permalink
Qualification classes use only mandatory fields in constructors.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertGHippo committed Aug 7, 2024
1 parent 049c8fd commit fc71e75
Show file tree
Hide file tree
Showing 11 changed files with 657 additions and 595 deletions.
29 changes: 17 additions & 12 deletions content/Dfe.EarlyYearsQualification.ContentUpload/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,18 +338,23 @@ private static List<QualificationUpload> GetQualificationsToAddOrUpdate()
ratioRequirementsArray = ratioRequirementsString.Split(':');
}

listObjResult.Add(new QualificationUpload(
qualificationId,
qualificationName,
awardingOrganisationTitle,
qualificationLevel,
fromWhichYear,
toWhichYear,
qualificationNumber,
additionalRequirements,
additionalRequirementQuestionsArray,
ratioRequirementsArray
));
var qualificationUpload =
new QualificationUpload(qualificationId,
qualificationName,
awardingOrganisationTitle,
qualificationLevel)
{
FromWhichYear = fromWhichYear,
ToWhichYear = toWhichYear,
QualificationNumber = qualificationNumber,
AdditionalRequirements =
additionalRequirements,
AdditionalRequirementQuestions =
additionalRequirementQuestionsArray,
RatioRequirements = ratioRequirementsArray
};

listObjResult.Add(qualificationUpload);
}

return listObjResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ public class QualificationUpload(
string qualificationId,
string qualificationName,
string awardingOrganisationTitle,
int qualificationLevel,
string? fromWhichYear,
string? toWhichYear,
string? qualificationNumber,
string? additionalRequirements,
string[]? additionalRequirementQuestions,
string[]? ratioRequirements)
int qualificationLevel)
{
// Required Fields
public string QualificationId { get; } = qualificationId;
Expand All @@ -19,12 +13,12 @@ public class QualificationUpload(
public int QualificationLevel { get; } = qualificationLevel;

// Optional Fields
public string? FromWhichYear { get; } = fromWhichYear;
public string? ToWhichYear { get; } = toWhichYear;
public string? QualificationNumber { get; } = qualificationNumber;
public string? AdditionalRequirements { get; } = additionalRequirements;
public string? FromWhichYear { get; init; }
public string? ToWhichYear { get; init; }
public string? QualificationNumber { get; init; }
public string? AdditionalRequirements { get; init; }

public string[]? AdditionalRequirementQuestions { get; } = additionalRequirementQuestions;
public string[]? AdditionalRequirementQuestions { get; init; }

public string[]? RatioRequirements { get; } = ratioRequirements;
public string[]? RatioRequirements { get; init; }
}
50 changes: 15 additions & 35 deletions src/Dfe.EarlyYearsQualification.Content/Entities/Qualification.cs
Original file line number Diff line number Diff line change
@@ -1,42 +1,22 @@
namespace Dfe.EarlyYearsQualification.Content.Entities;

public class Qualification
public class Qualification(
string qualificationId,
string qualificationName,
string awardingOrganisationTitle,
int qualificationLevel)
{
public Qualification(
string qualificationId,
string qualificationName,
string awardingOrganisationTitle,
int qualificationLevel,
string? fromWhichYear,
string? toWhichYear,
string? qualificationNumber,
string? additionalRequirements,
List<AdditionalRequirementQuestion>? additionalRequirementQuestions,
List<RatioRequirement>? ratioRequirements)
{
QualificationId = qualificationId;
QualificationName = qualificationName;
AwardingOrganisationTitle = awardingOrganisationTitle;
QualificationLevel = qualificationLevel;
FromWhichYear = fromWhichYear;
ToWhichYear = toWhichYear;
QualificationNumber = qualificationNumber;
AdditionalRequirements = additionalRequirements;
AdditionalRequirementQuestions = additionalRequirementQuestions;
RatioRequirements = ratioRequirements;
}

// Required Fields
public string QualificationId { get; }
public string QualificationName { get; }
public string AwardingOrganisationTitle { get; }
public int QualificationLevel { get; }
public string QualificationId { get; } = qualificationId;
public string QualificationName { get; } = qualificationName;
public string AwardingOrganisationTitle { get; } = awardingOrganisationTitle;
public int QualificationLevel { get; } = qualificationLevel;

// Optional Fields
public string? FromWhichYear { get; }
public string? ToWhichYear { get; }
public string? QualificationNumber { get; }
public string? AdditionalRequirements { get; }
public List<AdditionalRequirementQuestion>? AdditionalRequirementQuestions { get; }
public List<RatioRequirement>? RatioRequirements { get; }
public string? FromWhichYear { get; init; }
public string? ToWhichYear { get; init; }
public string? QualificationNumber { get; init; }
public string? AdditionalRequirements { get; init; }
public List<AdditionalRequirementQuestion>? AdditionalRequirementQuestions { get; init; }
public List<RatioRequirement>? RatioRequirements { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ private static Qualification CreateQualification(string qualificationId, string
return new Qualification(qualificationId,
$"{qualificationId}-test",
awardingOrganisation,
level,
startDate,
endDate,
"ghi/456/951",
"additional requirements",
null,
null);
level)
{
FromWhichYear = startDate,
ToWhichYear = endDate,
QualificationNumber = "ghi/456/951",
AdditionalRequirements = "additional requirements"
};
}
}
Loading

0 comments on commit fc71e75

Please sign in to comment.