Through row 116

This commit is contained in:
Anna Sidwell 2018-11-24 18:30:58 +00:00
parent 857634d1f1
commit 2fb4f8771c
4 changed files with 43 additions and 45 deletions

View File

@ -329,6 +329,7 @@ class LongCaseStudyForm(BaseCaseStudyForm):
'power_technology',
'power_technology_other',
'energy_storage_capacity',
'energy_transmission_capacity',
'maximum_power_output',
'discharge_time',
'contractor_or_supplier_of_technology',

View File

@ -661,37 +661,22 @@ class CaseStudy(models.Model):
# 2.2.1.4
power_technology_other = models.CharField(
verbose_name=_("Other power technology"),
help_text=_("Please specify the power technology."),
verbose_name=_("Further information about power technology"),
max_length=128,
blank=True
)
# 2.2.2
energy_storage_capacity = models.DecimalField(
verbose_name=_("Energy storage capacity"),
help_text=_("Enter the total capacity of the energy storage system in kilowatt-hours (kWh)."),
verbose_name=_("Total storage capacity (kWh)"),
max_digits=20,
decimal_places=3,
blank=True,
null=True,
)
# 2.2.2.1
maximum_power_output = models.DecimalField(
verbose_name=_('Maximum power output'),
help_text=_('Enter the maximum power output of the storage system in kilowatts (kW).'),
max_digits=12,
decimal_places=3,
blank=True,
null=True,
)
# 2.2.2.2
discharge_time = models.DecimalField(
verbose_name=_('Time for discharge from full capacity'),
help_text=_('Enter the time it takes to discharge from full capacity at maximum power output (in hours).'),
max_digits=6,
energy_transmission_capacity = models.DecimalField(
verbose_name=_("Total transmission capacity (kW)"),
max_digits=20,
decimal_places=3,
blank=True,
null=True,
@ -700,7 +685,7 @@ class CaseStudy(models.Model):
# 2.2.3
contractor_or_supplier_of_technology = models.CharField(
verbose_name=_('Contractor and/or supplier of technology'),
help_text=_('List companies that act as contractors or suppliers of technology related to energy storage.'),
help_text=_('List companies that act as contractors or suppliers  e.g. Siemens Gamesa, GE, Alstom, Vestas, Hanwha Q CELLS, Mitsubishi, First Solar, Jinko Solar, Trina Solar, Suzlon Energy, Statkraft, Shanghai Electric, Ballard Power Systems, Panasonic, etc'),
max_length=256,
blank=True
)
@ -715,10 +700,12 @@ class CaseStudy(models.Model):
)
# 2.2.5
additional_technical_details = models.CharField(
additional_technical_details = models.TextField(
verbose_name=_("Additional technical or economic details"),
help_text=_("Add any additional details such as: length, from-to, voltage, substations etc"),
max_length=512,
help_text=_("Add any additional details such as: length, from-to, voltage, \
substations, power output, (dis)charge rates, how this technology or \
project interacts with the energy system (e.g. provides reactive power \
to ensure power supply in phase etc.)"),
blank=True
)

View File

@ -301,16 +301,10 @@ dd ul { padding-left: 0; margin-left: 0; }
{{ case_study.energy_storage_capacity }} TODO UNITS?
{% endif %}
{% if case_study.maximum_power_output %}
<dt>{% trans "Maximum power output" %}:
<dd id="maximum_power_output">
{{ case_study.maximum_power_output | intcomma }} W
{% endif %}
{% if case_study.discharge_time %}
<dt>{% trans "Time for discharge from full capacity" %}:
<dd id="discharge_time">
{{ case_study.discharge_time | intcomma }} {% trans "seconds" %}
{% if case_study.energy_transmission_capacity %}
<dt>{% trans "Energy transmission capacity" %}:
<dd id="energy_transmission_capacity">
{{ case_study.energy_transmission_capacity }} TODO UNITS?
{% endif %}
{% if case_study.contractor_or_supplier_of_technology %}

View File

@ -40,6 +40,14 @@
<!-- Conditional logic for hiding and un-hiding fields. -->
<script>
function showIf(thingToShow, whetherToShowIt) {
if (whetherToShowIt) {
$(thingToShow).show()
} else {
$(thingToShow).hide()
}
}
// Here we define the fields we need to conditionally toggle.
// TODO: Move this knowledge out of the template
var conditionalFields = [
@ -102,13 +110,25 @@
name: "power_technology",
redraw: function() {
const other = document.getElementById('id_id_power_technology_0_4')
const showHide = document.getElementById('div_id_power_technology_other')
const panel = document.getElementById('div_id_power_technology_other')
if (other.checked) {
$(showHide).show();
} else {
$(showHide).hide();
}
showIf(panel, other.checked)
}
},
{
name: "power_technology",
redraw: function() {
const group = document.forms['case-study-form'].power_technology
// Storage / other
let showStorage = ['ES', 'OT'].includes(group.value)
// Transmission / heat / other
let showTransmission = ['PT', 'HN', 'OT'].includes(group.value)
showIf('#div_id_energy_storage_capacity', showStorage)
showIf('#div_id_energy_transmission_capacity', showTransmission)
}
},
@ -134,11 +154,7 @@
const input = document.getElementById(option.input)
const section = document.getElementById(option.section)
if (input.checked) {
$(section).show();
} else {
$(section).hide();
}
showIf(section, input.checked)
}
}
}