Skip to content

Commit

Permalink
Merge pull request #315 from UKGovernmentBEIS/staging
Browse files Browse the repository at this point in the history
staging -> main
  • Loading branch information
samyou-softwire authored Dec 3, 2024
2 parents 378619c + 16a2845 commit c922e9a
Show file tree
Hide file tree
Showing 31 changed files with 880 additions and 83 deletions.
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Add a brief description of the change(s) you have made
- [ ] I have checked there are no unintentional line ending changes
- [ ] I have added tests where applicable
- [ ] If I have made any changes to the code, I have used the IDE auto-formatter on it
- [ ] If I have made any changes to website flow, I have updated the [Flow Miro Board](https://miro.com/app/board/uXjVK6F2rKo=/)
- [ ] If I have made any changes to website flow, I have updated the [Flow Miro Board](https://miro.com/app/board/uXjVK4BNrG0=/)
- [ ] If I have made any changes to website flow, I have checked forward and back behaviour is still consistent
- [ ] If I have made any changes to content strings or resource files, I have followed [the documentation](https://github.com/UKGovernmentBEIS/beis-simple-energy-advice-beta/blob/main/docs/LocalisationDocumentation.md)

# Screenshots

<!--
Add any screenshots of your changes, if applicable
-->
-->
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

# User preferences
.idea
SimpleEnergyAdvice.sln.DotSettings.user
SimpleEnergyAdvice.sln.DotSettings

# Dependencies
node_modules/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class BreRequest

public int? roof_type { get; set; }

public bool? pv_panel { get; set; }

public int wall_type { get; set; }

public int glazing_type { get; set; }
Expand All @@ -57,7 +59,8 @@ public BreRequest(
int[] breNormalDaysOffHours,
decimal? breTemperature,
BreFloorType? breFloorType,
bool? breOutsideSpace
bool? breOutsideSpace,
bool? brePvPanels
)
{
property_type = ((int) brePropertyType).ToString();
Expand All @@ -67,6 +70,7 @@ public BreRequest(
wall_type = (int) breWallType;
//no input for floor_type in BRE API
roof_type = (int?) breRoofType;
pv_panel = brePvPanels;
glazing_type = (int) breGlazingType;
//no input for outdoor heater space in BRE API
heating_system = (int) breHeatingSystem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ private static BreRequest CreateRequest(PropertyData propertyData)

bool? breOutsideSpace = GetBreOutsideSpace(propertyData.HasOutdoorSpace);

bool? brePvPanels = GetBrePvPanels(propertyData.SolarElectricPanels);

BreRequest request = new(
brePropertyType: brePropertyType,
breBuiltForm: breBuiltForm,
Expand All @@ -177,7 +179,8 @@ private static BreRequest CreateRequest(PropertyData propertyData)
breNormalDaysOffHours: breNormalDaysOffHours,
breTemperature: propertyData.Temperature,
breFloorType: breFloorType,
breOutsideSpace: breOutsideSpace
breOutsideSpace: breOutsideSpace,
brePvPanels: brePvPanels
);

return request;
Expand Down Expand Up @@ -540,5 +543,17 @@ private static bool GetBreOutsideSpace(HasOutdoorSpace? hasOutdoorSpace)
_ => throw new ArgumentOutOfRangeException()
};
}

private static bool? GetBrePvPanels(SolarElectricPanels? solarElectricPanels)
{
return solarElectricPanels switch
{
SolarElectricPanels.Yes => true,
SolarElectricPanels.No => false,
SolarElectricPanels.DoNotKnow => false,
null => null,
_ => throw new ArgumentOutOfRangeException()
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public enum QuestionFlowStep
FloorConstruction,
FloorInsulated,
RoofConstruction,
SolarElectricPanels,
LoftSpace,
LoftAccess,
RoofInsulated,
Expand Down
14 changes: 14 additions & 0 deletions SeaPublicWebsite.BusinessLogic/Models/Enums/SolarElectricPanels.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;

namespace SeaPublicWebsite.BusinessLogic.Models.Enums
{
public enum SolarElectricPanels
{
[Display(ResourceType = typeof(Resources.Enum.SolarElectricPanels), Description = nameof(Resources.Enum.SolarElectricPanels.Yes))]
Yes,
[Display(ResourceType = typeof(Resources.Enum.SolarElectricPanels), Description = nameof(Resources.Enum.SolarElectricPanels.No))]
No,
[Display(ResourceType = typeof(Resources.Enum.SolarElectricPanels), Description = nameof(Resources.Enum.SolarElectricPanels.DoNotKnow))]
DoNotKnow
}
}
2 changes: 2 additions & 0 deletions SeaPublicWebsite.BusinessLogic/Models/PropertyData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class PropertyData
public FloorConstruction? FloorConstruction { get; set; }
public FloorInsulated? FloorInsulated { get; set; }
public RoofConstruction? RoofConstruction { get; set; }
public SolarElectricPanels? SolarElectricPanels { get; set; }
public LoftSpace? LoftSpace { get; set; }
public LoftAccess? LoftAccess { get; set; }
public RoofInsulated? RoofInsulated { get; set; }
Expand Down Expand Up @@ -140,6 +141,7 @@ public void ResetUnusedFields()
if (!HasRoof())
{
RoofConstruction = null;
SolarElectricPanels = null;
}

if (RoofConstruction is not Enums.RoofConstruction.Mixed and not Enums.RoofConstruction.Pitched)
Expand Down
12 changes: 12 additions & 0 deletions SeaPublicWebsite.BusinessLogic/PropertyDataUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,18 @@ public QuestionFlowStep UpdateRoofConstruction(
entryPoint);
}

public QuestionFlowStep UpdateSolarElectricPanels(
PropertyData propertyData,
SolarElectricPanels? solarElectricPanels,
QuestionFlowStep? entryPoint)
{
return UpdatePropertyData(
p => { p.SolarElectricPanels = solarElectricPanels; },
propertyData,
QuestionFlowStep.SolarElectricPanels,
entryPoint);
}

public QuestionFlowStep UpdateLoftSpace(
PropertyData propertyData,
LoftSpace? loftSpace,
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,23 @@
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Yes" xml:space="preserve">
<value>Oes</value>
</data>
<data name="No" xml:space="preserve">
<value>Nac oes</value>
</data>
<data name="DoNotKnow" xml:space="preserve">
<value>Ddim yn gwybod</value>
</data>
</root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>

<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">

</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Yes" xml:space="preserve">
<value>Yes</value>
</data>
<data name="No" xml:space="preserve">
<value>No</value>
</data>
<data name="DoNotKnow" xml:space="preserve">
<value>I don't know</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>BreBuiltForm.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Resources\Enum\SolarElectricPanels.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>SolarElectricPanels.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit c922e9a

Please sign in to comment.