Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove completed field and add sent to provider at #1295

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions GetIntoTeachingApi/Models/Apply/ApplicationChoice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class ApplicationChoice
public Course Course { get; set; }
[JsonProperty("interviews")]
public IEnumerable<Interview> Interviews { get; set; }
[JsonProperty("sent_to_provider_at")]
public DateTime? SentToProviderAt { get; set; }

public Crm.ApplicationChoice ToCrmModel()
{
Expand All @@ -35,6 +37,7 @@ public Crm.ApplicationChoice ToCrmModel()
CourseId = Course.Id?.ToString(),
CourseName = Course.Name,
Provider = Provider.Name,
SentToProviderAt = SentToProviderAt,
Interviews = Interviews?.Select(c => c.ToCrmModel()).ToList(),
};
}
Expand Down
1 change: 0 additions & 1 deletion GetIntoTeachingApi/Models/Apply/ApplicationForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public Crm.ApplicationForm ToCrmModel()
RecruitmentCycleYearId = yearId,
Choices = ApplicationChoices?.Data?.Select(c => c.ToCrmModel()).ToList(),
References = References?.Data?.Select(c => c.ToCrmModel()).ToList(),
ApplicationChoicesCompleted = ApplicationChoices?.Completed,
ReferencesCompleted = References?.Completed,
PersonalStatementCompleted = PersonalStatement?.Completed,
QualificationsCompleted = Qualifications?.Completed,
Expand Down
2 changes: 2 additions & 0 deletions GetIntoTeachingApi/Models/Crm/ApplicationChoice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public enum Status
public string CourseId { get; set; }
[EntityField("dfe_applicationchoiceprovider")]
public string Provider { get; set; }
[EntityField("dfe_senttoproviderat")]
public DateTime? SentToProviderAt { get; set; }
[EntityField("dfe_name")]
public string Name
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@
"LogicalName": "dfe_applyapplicationform",
"Id": "00000000-0000-0000-0000-000000000000",
"Attributes": [
{
"Key": "dfe_applicationchoicescompleted",
"Value": null
},
{
"Key": "dfe_applicationformid",
"Value": "1"
Expand Down Expand Up @@ -127,4 +123,4 @@
"RowVersion": null,
"KeyAttributes": []
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@
},
{
"Key": "dfe_name",
"Value": "Application Choice 1"
"Value": "Application Form 1"
},
{
"Key": "dfe_senttoproviderat",
"Value": "2022-03-14T14:23:39+00:00"
}
],
"EntityState": 1,
Expand All @@ -111,10 +115,6 @@
"LogicalName": "dfe_applyapplicationform",
"Id": "00000000-0000-0000-0000-000000000000",
"Attributes": [
{
"Key": "dfe_applicationchoicescompleted",
"Value": true
},
{
"Key": "dfe_applicationformid",
"Value": "1"
Expand Down Expand Up @@ -278,4 +278,4 @@
"RowVersion": null,
"KeyAttributes": []
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@
"LogicalName": "dfe_applyapplicationform",
"Id": "351aa675-e6bf-41c5-ad5f-4e1e8de5d5fe",
"Attributes": [
{
"Key": "dfe_applicationchoicescompleted",
"Value": null
},
{
"Key": "dfe_applicationformid",
"Value": "2"
Expand Down Expand Up @@ -121,4 +117,4 @@
"RowVersion": null,
"KeyAttributes": []
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
},
{
"Key": "dfe_name",
"Value": "Application Choice 1"
},
{
"Key": "dfe_senttoproviderat",
"Value": "Application Choice 2"
}
],
Expand All @@ -105,10 +109,6 @@
"LogicalName": "dfe_applyapplicationform",
"Id": "351aa675-e6bf-41c5-ad5f-4e1e8de5d5fe",
"Attributes": [
{
"Key": "dfe_applicationchoicescompleted",
"Value": true
},
{
"Key": "dfe_applicationformid",
"Value": "2"
Expand Down Expand Up @@ -272,4 +272,4 @@
"RowVersion": null,
"KeyAttributes": []
}
]
]
10 changes: 3 additions & 7 deletions GetIntoTeachingApiTests/Jobs/ApplyCandidateSyncJobTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using FluentAssertions;
using GetIntoTeachingApi.Jobs;
Expand Down Expand Up @@ -51,7 +51,7 @@ public ApplyCandidateSyncJobTests()
ApplicationStatus = "awaiting_candidate_response",
ApplicationPhase = "apply_1",
RecruitmentCycleYear = 2021,
ApplicationChoices = new ApplicationResponse<IEnumerable<ApplicationChoice>>() { Completed = false },
ApplicationChoices = new ApplicationResponse<IEnumerable<ApplicationChoice>>(),
References = new ApplicationResponse<IEnumerable<Reference>>() { Completed = false },
Qualifications = new ApplicationResponse<IEnumerable<object>>() { Completed = true },
PersonalStatement = new ApplicationResponse<IEnumerable<object>>() { Completed = null },
Expand All @@ -65,7 +65,7 @@ public ApplyCandidateSyncJobTests()
ApplicationStatus = "never_signed_in",
ApplicationPhase = "apply_2",
RecruitmentCycleYear = 2022,
ApplicationChoices = new ApplicationResponse<IEnumerable<ApplicationChoice>>() { Completed = false },
ApplicationChoices = new ApplicationResponse<IEnumerable<ApplicationChoice>>(),
References = new ApplicationResponse<IEnumerable<Reference>>() { Completed = false },
Qualifications = new ApplicationResponse<IEnumerable<object>>() { Completed = true },
PersonalStatement = new ApplicationResponse<IEnumerable<object>>() { Completed = null },
Expand Down Expand Up @@ -103,7 +103,6 @@ public void Run_OnSuccessWithExistingCandidateHavingSecondaryEmail_SetsIdAndQueu
RecruitmentCycleYearId = (int)GetIntoTeachingApi.Models.Crm.ApplicationForm.RecruitmentCycleYear.Year2022,
UpdatedAt = _forms[1].UpdatedAt,
SubmittedAt = _forms[1].SubmittedAt,
ApplicationChoicesCompleted = _forms[1].ApplicationChoices.Completed,
ReferencesCompleted = _forms[1].References.Completed,
PersonalStatementCompleted = _forms[1].PersonalStatement.Completed,
QualificationsCompleted = _forms[1].Qualifications.Completed,
Expand All @@ -118,7 +117,6 @@ public void Run_OnSuccessWithExistingCandidateHavingSecondaryEmail_SetsIdAndQueu
CreatedAt = _forms[0].CreatedAt,
UpdatedAt = _forms[0].UpdatedAt,
SubmittedAt = null,
ApplicationChoicesCompleted = _forms[0].ApplicationChoices.Completed,
ReferencesCompleted = _forms[0].References.Completed,
PersonalStatementCompleted = _forms[0].PersonalStatement.Completed,
QualificationsCompleted = _forms[0].Qualifications.Completed,
Expand Down Expand Up @@ -163,7 +161,6 @@ public void Run_OnSuccessWithNewCandidate_SetsChannelAndQueuesUpsertJobForCandid
RecruitmentCycleYearId = (int)GetIntoTeachingApi.Models.Crm.ApplicationForm.RecruitmentCycleYear.Year2022,
UpdatedAt = _forms[1].UpdatedAt,
SubmittedAt = _forms[1].SubmittedAt,
ApplicationChoicesCompleted = _forms[1].ApplicationChoices.Completed,
ReferencesCompleted = _forms[1].References.Completed,
PersonalStatementCompleted = _forms[1].PersonalStatement.Completed,
QualificationsCompleted = _forms[1].Qualifications.Completed,
Expand All @@ -178,7 +175,6 @@ public void Run_OnSuccessWithNewCandidate_SetsChannelAndQueuesUpsertJobForCandid
CreatedAt = _forms[0].CreatedAt,
UpdatedAt = _forms[0].UpdatedAt,
SubmittedAt = null,
ApplicationChoicesCompleted = _forms[0].ApplicationChoices.Completed,
ReferencesCompleted = _forms[0].References.Completed,
PersonalStatementCompleted = _forms[0].PersonalStatement.Completed,
QualificationsCompleted = _forms[0].Qualifications.Completed,
Expand Down
5 changes: 3 additions & 2 deletions GetIntoTeachingApiTests/Models/Apply/ApplicationFormTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void ToCrmModel_MapsToACrmApplicationFormModel()
Id = 456,
CreatedAt = new DateTime(2021, 1, 3),
UpdatedAt = new DateTime(2021, 1, 4),
SentToProviderAt = new DateTime(2021, 1, 5),
Status = "cancelled",
Provider = new Provider() { Name = "Provider Name" },
Course = new Course() { Id = Guid.NewGuid(), Name = "Course Name" },
Expand All @@ -69,7 +70,7 @@ public void ToCrmModel_MapsToACrmApplicationFormModel()
ApplicationStatus = "never_signed_in",
ApplicationPhase = "apply_1",
RecruitmentCycleYear = 2022,
ApplicationChoices = new ApplicationResponse<IEnumerable<ApplicationChoice>>() { Completed = true, Data = new List<ApplicationChoice> { choice } },
ApplicationChoices = new ApplicationResponse<IEnumerable<ApplicationChoice>>() { Data = new List<ApplicationChoice> { choice } },
References = new ApplicationResponse<IEnumerable<Reference>>() { Completed = false, Data = new List<Reference> { reference } },
Qualifications = new ApplicationResponse<IEnumerable<object>>() { Completed = true },
PersonalStatement = new ApplicationResponse<IEnumerable<object>>() { Completed = null },
Expand All @@ -84,8 +85,8 @@ public void ToCrmModel_MapsToACrmApplicationFormModel()
crmForm.PhaseId.Should().Be((int)GetIntoTeachingApi.Models.Crm.ApplicationForm.Phase.Apply1);
crmForm.RecruitmentCycleYearId.Should().Be((int)GetIntoTeachingApi.Models.Crm.ApplicationForm.RecruitmentCycleYear.Year2022);
crmForm.Choices.First().ApplyId.Should().Be(choice.Id.ToString());
crmForm.Choices.First().SentToProviderAt.Should().Be(choice.SentToProviderAt);
crmForm.References.First().ApplyId.Should().Be(reference.Id.ToString());
crmForm.ApplicationChoicesCompleted.Should().Be(form.ApplicationChoices.Completed);
crmForm.ReferencesCompleted.Should().Be(form.References.Completed);
crmForm.QualificationsCompleted.Should().Be(form.Qualifications.Completed);
crmForm.PersonalStatementCompleted.Should().Be(form.PersonalStatement.Completed);
Expand Down
Loading