Skip to content

Commit

Permalink
Power test export refactoring (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
jb3 authored Nov 1, 2024
1 parent 3afa4de commit 2559c92
Showing 1 changed file with 86 additions and 31 deletions.
117 changes: 86 additions & 31 deletions RIGS/templates/hs/power_print.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
{% load filters %}

{% block extrastyles %}
<paraStyle name="style.powerReviewed" alignment="center" backColor="green" textColor="white"/>
<paraStyle name="style.powerUnreviewed" alignment="center" backColor="red" textColor="white"/>
<paraStyle name="style.powerReviewed" borderPadding="3" alignment="center" backColor="green" textColor="white"/>
<paraStyle name="style.powerUnreviewed" borderPadding="3" alignment="center" backColor="red" textColor="white"/>
<paraStyle name="style.smallText" fontSize="8"/>

<paraStyle leftIndent="2in" rightIndent="2in" name="style.smallEvent" fontSize="10" alignment="center" backColor="green" textColor="white" borderPadding="4" borderColor="black"/>
<paraStyle leftIndent="2in" rightIndent="2in" name="style.mediumEvent" fontSize="10" alignment="center" backColor="orange" textColor="white" borderPadding="4" borderColor="black"/>
<paraStyle leftIndent="2in" rightIndent="2in" name="style.largeEvent" fontSize="10" alignment="center" backColor="red" textColor="white" borderPadding="4" borderColor="black"/>

<blockTableStyle id="powerTable">
<blockValign value="middle"/>
Expand All @@ -12,6 +17,10 @@
<lineStyle kind="LINEAFTER" colorName="black" thickness="1"/>
<lineStyle kind="LINEBEFORE" colorName="black" thickness="1"/>
</blockTableStyle>

<blockTableStyle id="voltageTable">
<blockValign value="middle"/>
</blockTableStyle>
{% endblock %}

{% block content %}
Expand All @@ -34,6 +43,16 @@
<h2 fontSize="16">Power Plan Information</h2>
<spacer length="15"/>

{% if object.event.riskassessment.event_size == 0 %}
<para style="style.smallEvent"><strong>Small Event</strong></para>
{% elif object.event.riskassessment.event_size == 1 %}
<para style="style.mediumEvent"><strong>Medium Event</strong></para>
{% elif object.event.riskassessment.event_size == 2 %}
<para style="style.largeEvent"><strong>Large Event</strong></para>
{% endif %}

<spacer length="15"/>

<blockTable colWidths="250,250">
<tr>
<td><para><strong>Power MIC:</strong> {{ object.power_mic }}</para></td>
Expand All @@ -54,35 +73,56 @@
<hr/>
<spacer length="15"/>

<condPageBreak height="10in"/>

<h2 fontSize="16">Power Test Results</h2>
<spacer length="15"/>

<para><strong>Source RCD protected?</strong> {{ object.source_rcd|yesno|capfirst }}</para>
<para><sub>(If cable is more than 3 metres long)</sub></para>
{% comment %}
0 - Small event
1 - Medium event (extra power records)
2 - Large event (extra power records)
{% endcomment %}

<spacer length="5"/>
{% if object.event.riskassessment.event_size >= 1 %}

<para><strong>Appropriate and clear labelling on distribution and cabling?</strong> {{ object.labelling|yesno|capfirst }}</para>
<para alignment="center"><strong>Power Test results enclosed on next page</strong></para>

<spacer length="5"/>

<para><strong>Equipment appropriately earthed?</strong> {{ object.source_rcd|yesno|capfirst }}</para>
<para><sub>(truss, stage, generators etc.)</sub></para>
<condPageBreak height="10in"/>

<spacer length="5"/>
<h2 fontSize="16">Event Power Checklist</h2>
<spacer length="15"/>

<para><strong>All equipment in PAT period?</strong> {{ object.pat|yesno|capfirst }}</para>
<blockTable colWidths="250,270" style="powerTable">
<tr>
<td><para><strong>All circuit RCDs tested?</strong></para><para style="style.smallText">(using test button)</para></td>
<td><para>{{ object.all_rcds_tested|yesno|capfirst }}</para></td>
</tr>
<tr>
<td><para><strong>Public/performer accessible circuits tested?</strong></para><para style="style.smallText">(using socket tester)</para></td>
<td><para>{{ object.public_sockets_tested|yesno|capfirst }}</para></td>
</tr>
<tr>
<td><para><strong>Source RCD protected?</strong></para><para style="style.smallText">(if cable is more than 3m long)</para></td>
<td><para>{{ object.source_rcd|yesno|capfirst }}</para></td>
</tr>
<tr>
<td><para><strong>Appropriate and clear labelling on distribution and cabling?</strong></para></td>
<td><para>{{ object.labelling|yesno|capfirst }}</para></td>
</tr>
<tr>
<td><para><strong>Equipment appropriately earthed?</strong></para><para style="style.smallText">(truss, stage, generators, etc.)</para></td>
<td><para>{{ object.earthing|yesno|capfirst }}</para></td>
</tr>
<tr>
<td><para><strong>All equipment in PAT period?</strong><br/><br/></para></td>
<td><para>{{ object.pat|yesno|capfirst }}</para></td>
</tr>
</blockTable>

<spacer length="15"/>

<h2 fontSize="14">Tests at first distro</h2>
<h2 fontSize="14">Power tests (First Distro)</h2>
<spacer length="5"/>

<blockTable colWidths="100,410">
<blockTable colWidths="100,410" style="voltageTable">
<tr>
<td><para><strong>Voltage<br/><sub>(cube meter) / V</sub></strong></para></td>
<td><para><strong>Voltage</strong></para><para style="style.smallText">(cube meter) / V</para></td>
<td>
<blockTable colWidths="100,100,100" style="powerTable">
<tr>
Expand All @@ -100,11 +140,11 @@
</tr>
</blockTable>

<spacer length="15"/>
<spacer length="10"/>

<blockTable colWidths="100,100,190,120">
<blockTable colWidths="100,100,190,120" style="voltageTable">
<tr>
<td><para><strong>Phase Rotation<br/><sub>(if required)</sub></strong></para></td>
<td><para><strong>Phase Rotation</strong></para><para style="style.smallText">(if required)</para></td>
<td><para>{{ object.fd_phase_rotation|yesno|capfirst }}</para></td>
<td><para><strong>Earth Fault Loop Impedance (Z<sub>s</sub>) / Ω</strong></para></td>
<td><para>{{ object.fd_earth_fault }}</para></td>
Expand All @@ -113,11 +153,11 @@

<spacer length="15"/>

<para><strong>Prospective Short Circuit Current / A</strong> {{ object.fd_pssc }}</para>
<para><strong>Prospective Short Circuit Current (PSCC)</strong> {{ object.fd_pssc }} A</para>

<spacer length="15"/>

<h2 fontSize="14">Tests 'Worst Case' points (at least 1 required)</h2>
<h2 fontSize="14">Power Tests (Worst Case Points)</h2>
<spacer length="15"/>

<blockTable colWidths="100,100,190,120" style="powerTable">
Expand Down Expand Up @@ -153,18 +193,33 @@
{% endif %}
</blockTable>

<spacer length="15"/>
<h2 fontSize="14">Generic Tests</h2>
{% else %}

{% comment %}
Small power test
{% endcomment %}

<h2 fontSize="16">Power Checklist</h2>
<spacer length="15"/>

<blockTable colWidths="250,270" style="powerTable">
<tr>
<td><para><strong>All circuit RCDs tested?</strong><br/>(using test button)</para></td>
<td><para>{{ object.all_rcds_tested|yesno|capfirst }}</para></td>
<td><para><strong>RCDs installed where needed and tested?</strong><br/><br/></para></td>
<td><para>{{ object.rcds|yesno|capfirst }}</para></td>
</tr>
<tr>
<td><para><strong>Public/performer accessible circuits tested?</strong><br/>(using socket tester)</para></td>
<td><para>{{ object.public_sockets_tested|yesno|capfirst }}</para></td>
<td><para><strong>Electrical supplies tested?</strong><br/><br/></para></td>
<td><para>{{ object.supply_test|yesno|capfirst }}</para></td>
</tr>
<tr>
<td><para><strong>Equipment appropriately earthed?</strong></para><para style="style.smallText">(truss, stage, generators, etc.)</para></td>
<td><para>{{ object.earthing|yesno|capfirst }}</para></td>
</tr>
<tr>
<td><para><strong>All equipment in PAT period?</strong><br/><br/></para></td>
<td><para>{{ object.pat|yesno|capfirst }}</para></td>
</tr>
</blockTable>
{% endif %}

{% endblock %}

3 comments on commit 2559c92

@FreneticScribbler
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the help_text filter for the field names, as per the detail page? I know it's a bit anti-pattern but I did it like that because the specific wording of all parts of the H&S paperwork is quite important, and ideally needs to match exactly at all times.

@jb3
Copy link
Member Author

@jb3 jb3 commented on 2559c92 Nov 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the help_text filter for the field names, as per the detail page?

I did consider this and try this. The main problem is the slight variations between the help text in HTML vs. RML. For example as far as I could see <small> doesn't exist in RML (<sub> does but I've opted for a styled <para>) and so it actually worsened the formatting and clarity.

I did make sure everything matches both the input form and the RAMS for working to BS7909 (there aren't any wording changes other than section titles really). In another project I use Palantir's review bot to assign reviewers based on certain path changes, seems like asking a power supervisor or someone to review changes to files like this is the best way to ensure consistency and RAMS adherence.

I can have another look at the help_text filter but my guess is the subtle differences between RML and HTML make it not as useful.

@FreneticScribbler
Copy link
Member

@FreneticScribbler FreneticScribbler commented on 2559c92 Nov 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My solution for ra_print was just to feed it through striptags, but I can see how that might not be ideal - I'm just wary of having more than one place changes need to be made, given our history with keeping paperwork up to date and stuff.

In another project I use Palantir's review bot to assign reviewers based on certain path changes, seems like asking a power supervisor or someone to review changes to files like this is the best way to ensure consistency and RAMS adherence.

This seems like it would be a good thing to implement either way.

Please sign in to comment.