Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #195 from AppliedIS/issue124
Browse files Browse the repository at this point in the history
Issue124
  • Loading branch information
jefferey committed Dec 1, 2016
2 parents db260a0 + 2745468 commit 080bc74
Show file tree
Hide file tree
Showing 12 changed files with 181 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ public EmployerValidatorInitial(IAddressValidator addressValidator)
RuleFor(a => a.ProvidingFacilitiesDeductionType)
.NotNull()
.Must(p => p.Any() && !p.Any(x => x.ProvidingFacilitiesDeductionTypeId < ResponseIds.ProvidingFacilitiesDeductionType.Transportation) && !p.Any(x => x.ProvidingFacilitiesDeductionTypeId > ResponseIds.ProvidingFacilitiesDeductionType.Other));
RuleFor(a => a.ProvidingFacilitiesDeductionTypeOther)
.NotEmpty()
.When(a => a.ProvidingFacilitiesDeductionType != null && a.ProvidingFacilitiesDeductionType.Any(x => x.ProvidingFacilitiesDeductionTypeId == ResponseIds.ProvidingFacilitiesDeductionType.Other));
});
RuleFor(e => e.TradeName).NotEmpty().When(e => e.HasTradeName.GetValueOrDefault());
RuleFor(e => e.PriorLegalName).NotEmpty().When(e => e.LegalNameHasChanged.GetValueOrDefault());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@
<Compile Include="Migrations\201611301931465_AddEmployerMailingAddress.Designer.cs">
<DependentUpon>201611301931465_AddEmployerMailingAddress.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201612011901196_RemoveProvidingFacilitiesDeductionTypeOther.cs" />
<Compile Include="Migrations\201612011901196_RemoveProvidingFacilitiesDeductionTypeOther.Designer.cs">
<DependentUpon>201612011901196_RemoveProvidingFacilitiesDeductionTypeOther.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Repositories\ApplicationRepository.cs" />
Expand Down Expand Up @@ -389,6 +393,9 @@
<EmbeddedResource Include="Migrations\201611301931465_AddEmployerMailingAddress.resx">
<DependentUpon>201611301931465_AddEmployerMailingAddress.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201612011901196_RemoveProvidingFacilitiesDeductionTypeOther.resx">
<DependentUpon>201612011901196_RemoveProvidingFacilitiesDeductionTypeOther.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace DOL.WHD.Section14c.DataAccess.Migrations
{
using System;
using System.Data.Entity.Migrations;

public partial class RemoveProvidingFacilitiesDeductionTypeOther : DbMigration
{
public override void Up()
{
DropColumn("dbo.EmployerInfoes", "ProvidingFacilitiesDeductionTypeOther");
}

public override void Down()
{
AddColumn("dbo.EmployerInfoes", "ProvidingFacilitiesDeductionTypeOther", c => c.String());
}
}
}

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion DOL.WHD.Section14c.DataAccess/Migrations/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected override void Seed(ApplicationDbContext context)
context.Responses.AddOrUpdate(new Response { Id = ResponseIds.ProvidingFacilitiesDeductionType.Transportation, QuestionKey = "ProvidingFacilitiesDeductionType", Display = "Transportation", IsActive = true });
context.Responses.AddOrUpdate(new Response { Id = ResponseIds.ProvidingFacilitiesDeductionType.Rent, QuestionKey = "ProvidingFacilitiesDeductionType", Display = "Rent", IsActive = true });
context.Responses.AddOrUpdate(new Response { Id = ResponseIds.ProvidingFacilitiesDeductionType.Meals, QuestionKey = "ProvidingFacilitiesDeductionType", Display = "Meals", IsActive = true });
context.Responses.AddOrUpdate(new Response { Id = ResponseIds.ProvidingFacilitiesDeductionType.Other, QuestionKey = "ProvidingFacilitiesDeductionType", Display = "Other, please specify:", OtherValueKey = "providingFacilitiesDeductionTypeOther", IsActive = true });
context.Responses.AddOrUpdate(new Response { Id = ResponseIds.ProvidingFacilitiesDeductionType.Other, QuestionKey = "ProvidingFacilitiesDeductionType", Display = "Other Facilities", IsActive = true });

// PayType
context.Responses.AddOrUpdate(new Response { Id = ResponseIds.PayType.Hourly, QuestionKey = "PayType", Display = "Hourly", IsActive = true });
Expand Down
2 changes: 0 additions & 2 deletions DOL.WHD.Section14c.Domain/Models/Submission/EmployerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ public IEnumerable<int> ProvidingFacilitiesDeductionTypeId
}
public virtual ICollection<EmployerInfoProvidingFacilitiesDeductionType> ProvidingFacilitiesDeductionType { get; set; }

public string ProvidingFacilitiesDeductionTypeOther { get; set; }

public bool? TemporaryAuthority { get; set; }

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,6 @@ public void Should_Require_ProvidingFacilitiesDeductionType()
EmployerValidator.ShouldNotHaveValidationErrorFor(x => x.ProvidingFacilitiesDeductionType, model);
}

[TestMethod]
public void Should_Require_ProvidingFacilitiesDeductionTypeOther()
{
EmployerValidator.ShouldNotHaveValidationErrorFor(x => x.ProvidingFacilitiesDeductionTypeOther, "");
var model = new EmployerInfo { TakeCreditForCosts = true, ProvidingFacilitiesDeductionTypeId = new List<int> { ResponseIds.ProvidingFacilitiesDeductionType.Other }, ProvidingFacilitiesDeductionTypeOther = null };
EmployerValidator.ShouldHaveValidationErrorFor(x => x.ProvidingFacilitiesDeductionTypeOther, model);
model = new EmployerInfo { TakeCreditForCosts = true, ProvidingFacilitiesDeductionTypeId = new List<int> { ResponseIds.ProvidingFacilitiesDeductionType.Other }, ProvidingFacilitiesDeductionTypeOther = "Other" };
EmployerValidator.ShouldNotHaveValidationErrorFor(x => x.ProvidingFacilitiesDeductionTypeOther, model);
}

[TestMethod]
public void Should_Require_TemporaryAuthority()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,6 @@ public void Should_Require_ProvidingFacilitiesDeductionType()
EmployerValidator.ShouldNotHaveValidationErrorFor(x => x.ProvidingFacilitiesDeductionType, model);
}

[TestMethod]
public void Should_Require_ProvidingFacilitiesDeductionTypeOther()
{
EmployerValidator.ShouldNotHaveValidationErrorFor(x => x.ProvidingFacilitiesDeductionTypeOther, "");
var model = new EmployerInfo { TakeCreditForCosts = true, ProvidingFacilitiesDeductionTypeId = new List<int> { ResponseIds.ProvidingFacilitiesDeductionType.Other }, ProvidingFacilitiesDeductionTypeOther = null };
EmployerValidator.ShouldHaveValidationErrorFor(x => x.ProvidingFacilitiesDeductionTypeOther, model);
model = new EmployerInfo { TakeCreditForCosts = true, ProvidingFacilitiesDeductionTypeId = new List<int> { ResponseIds.ProvidingFacilitiesDeductionType.Other }, ProvidingFacilitiesDeductionTypeOther = "Other" };
EmployerValidator.ShouldNotHaveValidationErrorFor(x => x.ProvidingFacilitiesDeductionTypeOther, model);
}

[TestMethod]
public void Should_Require_TemporaryAuthority()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public void EmployerInfo_PublicProperties()
var representativePayee = true;
var takeCreditForCosts = true;
var providingFacilitiesDeductionTypeId = new List<int> {15, 16, 17};
var providingFacilitiesDeductionTypeOther = "providingFacilitiesDeductionTypeOther";
var temporaryAuthority = true;

var model = new EmployerInfo
Expand Down Expand Up @@ -74,7 +73,6 @@ public void EmployerInfo_PublicProperties()
RepresentativePayee = representativePayee,
TakeCreditForCosts = takeCreditForCosts,
ProvidingFacilitiesDeductionTypeId = providingFacilitiesDeductionTypeId,
ProvidingFacilitiesDeductionTypeOther = providingFacilitiesDeductionTypeOther,
TemporaryAuthority = temporaryAuthority
};

Expand Down Expand Up @@ -108,7 +106,6 @@ public void EmployerInfo_PublicProperties()
Assert.AreEqual(providingFacilitiesDeductionTypeId[0], model.ProvidingFacilitiesDeductionType.ElementAt(0).ProvidingFacilitiesDeductionTypeId);
Assert.AreEqual(providingFacilitiesDeductionTypeId[1], model.ProvidingFacilitiesDeductionType.ElementAt(1).ProvidingFacilitiesDeductionTypeId);
Assert.AreEqual(providingFacilitiesDeductionTypeId[2], model.ProvidingFacilitiesDeductionType.ElementAt(2).ProvidingFacilitiesDeductionTypeId);
Assert.AreEqual(providingFacilitiesDeductionTypeOther, model.ProvidingFacilitiesDeductionTypeOther);
Assert.AreEqual(temporaryAuthority, model.TemporaryAuthority);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,6 @@ <h3>Additional Questions</h3>
<label for="deductionType_{{ response.id }}">{{ response.display }}</label>
</li>
</ul>
<span class="usa-input-error-message" role="alert" ng-show="validate('employer.providingFacilitiesDeductionTypeOther')">{{ validate('employer.providingFacilitiesDeductionTypeOther') }}</span>
<input id="deductionTypeOther" name="deductionTypeOther" type="text" ng-model="formData.employer.providingFacilitiesDeductionTypeOther">
</fieldset>
</div>
<div class="form-question-block" ng-class="validate('employer.temporaryAuthority') ? 'usa-input-error' : ''">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,6 @@ module.exports = function(ngModule) {
let takeCreditForCosts = this.checkRequiredMultipleChoice("employer.takeCreditForCosts", "Please indicate if the employer took credit for facility costs");
if (takeCreditForCosts === true) {
let deductions = this.checkRequiredValueArray("employer.providingFacilitiesDeductionTypeId", "Please select at least one deduction");
if (isArray(deductions) && deductions.includes(_constants.responses.providingFacilitiesDeductionType.other)) {
this.checkRequiredString("employer.providingFacilitiesDeductionTypeOther", "Please specify the type of deduction taken, or choose from one of the options above.");
}
}

this.checkRequiredMultipleChoice("employer.temporaryAuthority", "Please indicate if this is a request for temporary authority");
Expand Down

0 comments on commit 080bc74

Please sign in to comment.