diff --git a/djaopsp/static/js/assess-vue.js b/djaopsp/static/js/assess-vue.js
index e1ce1b4a..37113c83 100644
--- a/djaopsp/static/js/assess-vue.js
+++ b/djaopsp/static/js/assess-vue.js
@@ -24,7 +24,7 @@ Vue.component('campaign-questions-list', {
nbRequiredAnswers: this.$sample ? this.$sample.nbRequiredAnswers : 0,
nbRequiredQuestions: this.$sample ? this.$sample.nbRequiredQuestions : 0,
api_profiles_url: this.$urls.api_profiles,
- profilesBySlug: {}
+ profilesBySlug: {},
}
},
methods: {
@@ -701,8 +701,15 @@ Vue.component('campaign-questions-list', {
return parseInt(this.vsPeersToggle) > 0;
},
},
+ watch: {
+ itemsLoaded: function() {
+ var vm = this;
+ vm.$parent.items = vm.items;
+ }
+ },
mounted: function() {
var vm = this;
+ vm.prefix = vm.$parent.$prefix;
$("[id^='toggle-value-summary-']").change(function() {
vm.valueSummaryToggle = $(this).prop('checked');
});
@@ -758,9 +765,6 @@ Vue.component('scorecard', {
data: function() {
return {
url: this.$urls.survey_api_sample_answers,
- api_assessment_freeze: this.$urls.api_assessment_freeze ?
- this.$urls.api_assessment_freeze : this._safeUrl(
- this.$urls.api_assessment_sample, '/freeze'),
api_assessment_reset: this.$urls.api_assessment_reset ?
this.$urls.api_assessment_reset : this._safeUrl(
this.$urls.api_assessment_sample, '/reset'),
@@ -772,8 +776,7 @@ Vue.component('scorecard', {
params: {o: ""},
activeTile: null,
summaryPerformance: this.$summary_performance ? this.$summary_performance : [],
- freezeAssessmentDisabled: false,
- verificationStatus: ""
+ verificationStatus: "",
}
},
methods: {
@@ -931,29 +934,6 @@ Vue.component('scorecard', {
row.default_unit.system === 'imperial' ||
row.default_unit.system === 'rank');
},
- freezeAssessment: function($event) {
- var vm = this;
- vm.freezeAssessmentDisabled = true;
- vm.reqPost(vm.api_assessment_freeze, {is_frozen: true},
- function success(resp) {
- vm.freezeAssessmentDisabled = false;
- vm.$nextTick(function() {
- var modalDialog = jQuery('#complete-assessment.modal');
- if( modalDialog ) modalDialog.modal('hide');
- if( resp.location ) {
- window.location = resp.location;
- }
- });
- },
- function error(resp) {
- vm.freezeAssessmentDisabled = false;
- vm.$nextTick(function() {
- var modalDialog = jQuery('#complete-assessment.modal');
- if( modalDialog ) modalDialog.modal('hide');
- vm.showErrorMessages(resp);
- });
- });
- },
openLink: function(event) {
var vm = this;
var href = event.target.getAttribute('href');
@@ -983,6 +963,8 @@ Vue.component('scorecard', {
vm.items = {results: [], count: 0};
vm.itemsLoaded = false;
vm.get();
+ vm.$parent.$children[0].get();
+ /// Do a .get() whenever all survey responses are deleted.
});
},
setActiveElement: function(practice) {
@@ -1033,9 +1015,66 @@ Vue.component('scorecard', {
var vm = this;
vm.verificationStatus = vm.items.verified_status;
},
+ },
+ mounted() {
+ var vm = this;
+ vm.prefix = vm.$parent.$prefix;
}
});
+Vue.component('assess-scorecard', {
+ data: function() {
+ return {
+ showScorecardToggle: 0,
+ activeSidebarItem: '',
+ prefixVal: null,
+ api_assessment_freeze: this.$urls.api_assessment_freeze ?
+ this.$urls.api_assessment_freeze : this._safeUrl(
+ this.$urls.api_assessment_sample, '/freeze'),
+ freezeAssessmentDisabled: false,
+ items: {}
+ }
+ },
+ methods: {
+ setActive(slug) {
+ var vm = this;
+ vm.activeSidebarItem = slug;
+ },
+ freezeAssessment: function($event) {
+ var vm = this;
+ vm.freezeAssessmentDisabled = true;
+ vm.reqPost(vm.api_assessment_freeze, {is_frozen: true},
+ function success(resp) {
+ vm.freezeAssessmentDisabled = false;
+ vm.$nextTick(function() {
+ var modalDialog = jQuery('#complete-assessment.modal');
+ if( modalDialog ) modalDialog.modal('hide');
+ if( resp.location ) {
+ window.location = resp.location;
+ }
+ });
+ },
+ function error(resp) {
+ vm.freezeAssessmentDisabled = false;
+ vm.$nextTick(function() {
+ var modalDialog = jQuery('#complete-assessment.modal');
+ if( modalDialog ) modalDialog.modal('hide');
+ vm.showErrorMessages(resp);
+ });
+ });
+ },
+ },
+ watch: {
+ showScorecardToggle: function(val) {
+ var vm = this;
+ (vm.showScorecardToggle == 1) ? vm.$prefix = '' : vm.$prefix = vm.prefixVal;
+ }
+ },
+ mounted() {
+ var vm = this;
+ vm.prefixVal = vm.$prefix;
+ },
+});
/** Component used to display requested scorecards
diff --git a/djaopsp/templates/app/assess/_assess_component.html b/djaopsp/templates/app/assess/_assess_component.html
new file mode 100644
index 00000000..0a3442f0
--- /dev/null
+++ b/djaopsp/templates/app/assess/_assess_component.html
@@ -0,0 +1,526 @@
+
+
+
+ {% block dashboard_nav %}
+
+
+
+
+
+
+
+
+
+ {% block dashboard_footer %}
+
+ {% endblock %}
+
+
+
+
+
+ {% endblock %}
+
+
+
+
+
+
+ {% block content_navbarbrand %}
+
+ {% include "_navbarbrand.html" %}
+
+ {% endblock %}
+ {% block header_navbar_large %}
+
+
+ {% include "_generic_navbar.html" %}
+
+
+
+ {% endblock %}
+
+
+
+ {% block fullviewport %}
+ {% endblock %}
+
+
+
+
+ {% if request %}
+ {% for message in request|messages %}
+
+ {% endfor %}
+ {% endif %}
+ {% if form %}
+ {% for message in form|messages %}
+
+ {% endfor %}
+ {% endif %}
+ {# #}
+
+
+
+
+
+
+
+
+
+ {# nav item #}
+
+ {# /nav item #}
+
+ {# expanded tabs go here #}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Implemented as standard practice?
+
+
+
+
+
+
+ previous completed assessment
+
+
+
+
+
+ required answer
+
+
+
+
+
+
+
+
+
+
+ Practices
+ {% include "app/assess/_vs_peers_toggle.html" %}
+
+
+
+
+
+
+
+
+
+ {% include "app/assess/_assess_row.html" %}
+
+
+ {% if not sample.is_frozen %}
+
+
+
+
+ {% trans %}Reset{% endtrans %}
+
+
+
+
{# /.row (action buttons) #}
+
+ {% endif %}
+
+ {# /!showVsPeers #}
+
+
+
+
+
+
+ Practices
+ {% include "app/assess/_vs_peers_toggle.html" %}
+
+
+
+
+
+
+
+
+
+
+
+ {% include "app/assess/_assess_results_row.html" %}
+
+
+
+
+ {# /showVsPeers #}
+
+ {# /expanded tab #}
+
+ {# /v-for=icon #}
+
+ {% block icons_actions %}
+ {% endblock %}
+
+
+
+ {# /#syncBaselineAt #}
+
+ {# /#syncEndsAt #}
+ {% include "app/_reset_assessment.html" %}
+ {% include "app/_complete_assessment.html" %}
+ {% block panel_footer %}
+
+ {% endblock %}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djaopsp/templates/app/assess_scorecard/_assess_scorecard_toggle.html b/djaopsp/templates/app/assess_scorecard/_assess_scorecard_toggle.html
new file mode 100644
index 00000000..d81d9bce
--- /dev/null
+++ b/djaopsp/templates/app/assess_scorecard/_assess_scorecard_toggle.html
@@ -0,0 +1,10 @@
+
+
+
+
+
+ {% trans %}Assess{% endtrans %}
+ {% trans %}Scorecard{% endtrans %}
+
+
\ No newline at end of file
diff --git a/djaopsp/templates/app/assess_scorecard/_new_assess_row.html b/djaopsp/templates/app/assess_scorecard/_new_assess_row.html
new file mode 100644
index 00000000..9b56dd9c
--- /dev/null
+++ b/djaopsp/templates/app/assess_scorecard/_new_assess_row.html
@@ -0,0 +1,616 @@
+
+
+
+{# column headers #}
+{# when enum choices are not shown in table header #}
+
+
+{# when enum choices are shown in table header #}
+
+
+
+
+
+
+
+
+
+ [11] Agriculture, Forestry, Fishing and Hunting
+ [21] Mining, Quarrying, and Oil and Gas Extraction
+ [22] Utilities
+ [23] Construction
+ [31-33] Manufacturing
+ [42] Wholesale Trade
+ [44-45] Retail Trade
+ [48-49] Transportation and Warehousing
+ [51] Information
+ [52] Finance and Insurance
+ [53] Real Estate and Rental and Leasing
+ [54] Professional, Scientific, and Technical Services
+ [55] Management of Companies and Enterprises
+ [56] Administrative and Support and Waste Management and Remediation Services
+ [61] Educational Services
+ [62] Health Care and Social Assistance
+ [71] Arts, Entertainment, and Recreation
+ [72] Accommodation and Food Services
+ [81] Other Services (except Public Administration)
+ [92] Public Administration
+
+
+
+
+{# Presents questions based on its ui_hint and default unit #}
+
+
+
+
+{# The unit is fixed. question.ui_hint === 'revenue' #}
+
+
+
+
+
+ 0-10 employees
+ 11-50 employees
+ 51-200 employees
+ 201-500 employees
+ 501-1,000 employees
+ 1,001-5,000 employees
+ 5,001-10,000 employees
+ 10,001+ employees
+
+
+
+
+
+
+
+{# Energy consumed #}
+{# - The unit is variable (out of an "energy units" drop down list) #}
+{# - question.ui_hint === 'energy' #}
+
+
+
+
+
+
+
+
+
+
+ Btu
+ mmBtu
+ Kilowatt-hour (kWh)
+ Megawatt-hour (MWh)
+ Kilo Joules (KJ)
+ Mega Joules (MJ)
+ Giga Joules (GJ)
+
+
+
+
import from tracking tool
+
enter data in tracking tool »
+
+
+{# end of energy #}
+
+
+{# water #}
+{# - The unit is variable (out of an "water units" drop down list) #}
+{# - question.ui_hint === 'water' #}
+
+
+
+
+
+
+
+
+
+
+ Cubic meters (m3 )
+ Kilo liters
+ Cubic feet (ft.3 )
+ US Gallon
+
+
+
+
import from tracking tool
+
enter data in tracking tool »
+
+
+{# end of water #}
+
+{# waste #}
+{# - The unit is variable (out of an "waste units" drop down list) #}
+{# - question.ui_hint === 'waste' #}
+
+
+
+
+
+
+
+
+
+
+ Metric tons
+ Pounds
+ Cubic meters (m3 )
+ Kilo liters
+ Cubic feet (ft.3 )
+ US Gallon
+
+
+
+
import from tracking tool
+
enter data in tracking tool »
+
+
+{# end of waste #}
+
+{# GHG Emissions #}
+
+
+
+
+
+
+
+
+
+
+ Metric Tons CO2e
+
+
+
+
import from tracking tool
+
enter data in tracking tool »
+
+
+{# end of scope ghg emissions #}
+
+
+{# when question.unit is 'verifiability' #}
+
+
+
+
+ {% trans %}Select supporting document ...{% endtrans %}
+ {% for option in units.supporting_document %}
+ {{option.descr}}
+ {% endfor %}
+
+
+
+
+{# when question.unit.system is 'enum' and UI hint computes to 'select' #}
+
+
+ Select ...
+ [[choice.descr]]
+
+
+
+{# when question.unit.system is 'enum' and UI hint computes to 'radio' #}
+
+
{# form-check #}
+
+
+
+
+ [[choice.descr ? choice.descr : ""]]
+
+
+
+
+{# Targets #}
+
+
+
+ No target
+ 2024
+ 2025
+ 2026
+ 2027
+ 2028
+ 2029
+ 2030
+ 2031
+ 2032
+ 2033
+ 2034
+ 2035
+ 2036
+ 2037
+ 2038
+ 2039
+ 2040
+ 2041
+ 2042
+ 2043
+ 2044
+ 2045
+ 2046
+ 2047
+ 2048
+ 2049
+ 2050
+ 2051
+ 2052
+ 2053
+ 2054
+ 2055
+ 2056
+ 2057
+ 2058
+ 2059
+ 2060
+ 2061
+ 2062
+ 2063
+ 2064
+ 2065
+
+
+
+{# end target #}
+
+
+{# optional comments #}
+
+
+
+
+ {# comments #}
+
+
{% trans %}Notes, Public URL Links, and/or Uploaded Documents{% endtrans %}
+
+ You selected "Not Applicable" , please explain.
+
+
+
+
+
update
+
+
+
+
+
[[collectedByPrintableName]]
+
+
[[humanizeDate(collectedAtTime)]]
+
([[humanizeTimeDelta(collectedAtTime)]])
+
+
+
+
+
+ {% trans %}No notes were added.{% endtrans %}
+
+
+
+
+
+
+
+
+
diff --git a/djaopsp/templates/app/assess_scorecard/base.html b/djaopsp/templates/app/assess_scorecard/base.html
new file mode 100644
index 00000000..3a571115
--- /dev/null
+++ b/djaopsp/templates/app/assess_scorecard/base.html
@@ -0,0 +1,20 @@
+{% extends "app/base.html" %}
+
+{% block app_content %}
+{% block scorecard_content %}
+{% endblock %}
+{% endblock %}
+
+{% block app_bodyscripts %}
+{% if ASSETS_DEBUG %}
+
+
+
+
+
+
+{% else %}
+
+{% endif %}
+{% block assess_scorecard_scripts %}{% endblock %}
+{% endblock %}
\ No newline at end of file
diff --git a/djaopsp/templates/app/assess_scorecard/index.html b/djaopsp/templates/app/assess_scorecard/index.html
new file mode 100644
index 00000000..aa2d0b38
--- /dev/null
+++ b/djaopsp/templates/app/assess_scorecard/index.html
@@ -0,0 +1,18 @@
+{% extends "app/assess_scorecard/base.html" %}
+
+{% block supercontent %}
+
+
+
+ {% block app_content %}
+
+ {% include 'app/assess/_assess_component.html' %}
+
+
+ {% include 'app/scorecard/_scorecard_component.html' %}
+
+ {% endblock %}
+
+
+
+{% endblock %}
diff --git a/djaopsp/templates/app/scorecard/_scorecard_component.html b/djaopsp/templates/app/scorecard/_scorecard_component.html
new file mode 100644
index 00000000..cd1414f7
--- /dev/null
+++ b/djaopsp/templates/app/scorecard/_scorecard_component.html
@@ -0,0 +1,933 @@
+
+
+
+ {% block dashboard_nav %}
+
+
+
+
+
+
+
+
+
+ {% block dashboard_footer %}
+
+ {% endblock %}
+
+
+
+
+
+ {% endblock %}
+
+
+
+
+
+
+ {% block content_navbarbrand %}
+
+ {% include "_navbarbrand.html" %}
+
+ {% endblock %}
+ {% block header_navbar_large %}
+
+
+ {% include "_generic_navbar.html" %}
+
+
+
+ {% endblock %}
+
+
+
+ {% block fullviewport %}
+ {% endblock %}
+
+
+
+
+ {% if request %}
+ {% for message in request|messages %}
+
+ {% endfor %}
+ {% endif %}
+ {% if form %}
+ {% for message in form|messages %}
+
+ {% endfor %}
+ {% endif %}
+ {# #}
+
+
+
+
+
+
+ {% if not sample.is_frozen %}
+
+
+ {% trans %}This report is a work in
+ progress.{% endtrans %}
+ {% trans %}Once you are ready, please click the "Complete"
+ button at the
+ bottom of the page to create a frozen report. The report
+ will then
+ appear under "Historical assessments" and can be shared
+ with
+ customers and stakeholders.{% endtrans %}
+
+
+ {% endif %}
+
+
+
+
+
+
+
+
{{ sample.account.printable_name }}
+
{{ sample.campaign.title }}
+
{{ sample.created_at|date }}
+
+
+
+
+
+ {% for highlight in highlights %}
+
+
+
+
+ {{ highlight.text }}
+
+
+ {% endfor %}
+
+
+
+
+ Contact Information
+
+ {% if sample.account.email %}
+ {{ sample.account.email }}{% else %}
+ {% endif %}
+ {% if sample.account.phone %}
+ {{ sample.account.phone }}{% else %}
+ {% endif %}
+
+
+
+
+
+
+ {% if summary_performance %}
+
+
+
+ {% endif %}
+
+
+
+ {# /.col-sm-8 #}
+
+
+
+
+
+ {% include "app/_score_arcs.html" %}
+
+
+ source: {{ request|site_url }}
+
+
+
+
+ {# /.row #}
+
+
+ {% if verification_enabled %}
+
+
+
+ (grey) {% trans %}Not yet
+ reviewed nor
+ verified{% endtrans %}
+ (grey) {% trans %}Under
+ review{% endtrans %}
+ (grey) {% trans %}
+ Verification
+ completed{% endtrans %}
+ (red) {% trans %}Found
+ serious
+ discrepancies between responses and supporting
+ documents{% endtrans %}
+ (orange)
+ {% trans %}Responses
+ are technically accurate but lacking
+ consistency with the
+ pool of suppliers
+ reviews {% endtrans %}
+ (green)
+ {% trans %}Responses
+ are consistent with average answers and
+ supporting
+ documents{% endtrans %}
+ (gold) {% trans %}All
+ questions have
+ been answered positively with supporting
+ documentation more
+ rigorously detailed than the pool of suppliers
+ reviewed.{% endtrans %} ({% trans %}not yet
+ shared{% endtrans %})
+
+
+
+ {% endif %}
+
+
+ {# /.row #}
+
+ {# /#summary #}
+
+ {% if not sample.is_frozen %}
+ {% if urls.assess_mandatory_segment and not is_mandatory_segment_present %}
+
+
+
+ {% if sample.campaign.description %}
+ {{ sample.campaign.description }}
+ {% endif %}
+
+
+ {% trans %}Click Assess in the horizontal progress bar
+ at the top of
+ the page to get started!{% endtrans %}
+
+
+ {% endif %}{# /no answer on mandatory segment #}
+ {% endif %}{# /not sample.is_frozen #}
+
+
+
+
+
+
+
+
+ {# segment title #}
+
+
+
+
+
+
[[practice.title]]
+
+ {% if not sample.is_frozen %}
+
+ {% endif %}
+
+ {# scorecard for segment #}
+
+
+
+ {# XXX copy/pasted from _tile_chart.html? #}
+
+
+
{% trans %}There is not
+ enough data
+ available to benchmark with
+ peers.{% endtrans %}
+
+
+
+
+ {# /.col-sm-8 #}
+
+
+ [[asPercent(practice.normalized_score)]]
+
+
+ {# /.col-sm-4 #}
+
+ {# /scorecard for segment #}
+
+ {# summary of tile sections #}
+
+
+
+
+
+
+
+
[[subheading.title]]
+
([[asPercent(subheading.normalized_score)]])
+
+
+
+
+
There is not enough
+ data available
+ to benchmark with peers.
+
+
+
+
+
+
+
+ {% trans %}Benchmarking is based on responses
+ from{% endtrans %}
+ ? [[getNbRespondents(practice)]]
+ {% trans %}companies responding on practices in the
+ industry
+ segment.{% endtrans %}
+
+
+ {# /practice.indent == 0 #}
+
+
+ {# tile title #}
+
+
+
+
+
[[practice.title]]
+
+
+ {# summary when no tile sections #}
+
+
+
+ {# XXX copy/pasted from _tile_chart.html? #}
+
+
+
{% trans %}There is not
+ enough data
+ available to benchmark with
+ peers.{% endtrans %}
+
+
+
+
+ {# /.col-sm-8 #}
+
+
+ [[asPercent(practice.normalized_score)]]
+
+
+ {# /.col-sm-4 #}
+
+
+ {# /practice.indent > 0 #}
+
+
+ {# /.isChartHeading - i.e. heading with charts and score #}
+
+ {# Beginning of details section #}
+
+
+
+
+
+
+
+
+
[[practice.title]]
+
+
+
+ {# /.row #}
+
+ {# different layout for differnt type of questions. #}
+
+
+
+
+
+ [[year]]
+
+
+
+ [[total.title]]
+
+ [[getColValue(total, year)]]
+
+
+
+ [[getCaptionTitle(practice)]]
+
+
+
+ {# /.isDataMetricsHeader #}
+
+ {# /!isChartHeading(practice) && !isPractice(practice) - i.e. regular heading #}
+
+
+
+
+
+ [[practice.title]]
+
+
+
+
+ {% trans %}Implementation rate{% endtrans %}
+
+ [[practice.nb_respondents]] {% trans %}
+ respondents{% endtrans %}
+
+
+ [[asPercent(getRate(practice))]]
+
+
+
+
+ {% trans %}Opportunity score{% endtrans %}
+
+ [[getOpportunity(practice)]]
+
+
+ {# XXX Temporarily disabled until we handle special 2-values case #}
+ {#
#}
+ {#
#}
+ {#
#}
+ {#
#}
+ {#
#}
+ {# [[asPercent(value[1])]] #}
+ {#
#}
+ {#
[[value[0] ]] #}
+ {#
#}
+ {#
#}
+ {#
#}
+ {#
#}
+
+ {# /practice-related information #}
+
+
+
+
+
+ [[getPrimaryAnswer(practice).measured
+ ?
+ getMeasured(getPrimaryAnswer(practice))
+ :
+ "-"]]
+
+
+
+
+ ({% trans %}planned{% endtrans %}:
+ [[getPrimaryPlanned(practice).measured]] )
+
+
+
+
+
+
+ {# /.row assessment answer #}
+ {% include "app/scorecard/_secondary_answers.html" %}
+
+ {# /isEnumUnit(practice) #}
+
+
+
+
+
+ [[practice.title]]
+
+
+
+
+
+ {# /.row assessment answer #}
+ {% include "app/scorecard/_secondary_answers.html" %}
+
+ {# /isFreetextUnit(practice) #}
+
+
+
+
+
+ [[practice.title]]
+
+
+
+
+
+ ‐
+
+
+ 0-10 employees
+ 11-50 employees
+ 51-200 employees
+ 201-500 employees
+ 501-1,000 employees
+ 1,001-5,000 employees
+ 5,001-10,000 employees
+ 10,001+ employees
+
+
+
+ {# /.row #}
+
+ {# /isEmployeeCountUIHint(practice) #}
+
+
+
+
+
+
+
+ [[getPrimaryAnswer(practice).measured]]
+
+
+ ‐
+
+
+
+
+ {# /.row #}
+ {% include "app/scorecard/_secondary_answers.html" %}
+
+ {# /isNumberUnit(practice) #}
+
+
+
+
+
+ [[practice.title]]
+
+
+
+
+
+
+ [[getPrimaryAnswer(practice).measured]]
+
+
+ ‐
+
+
+
+
+ {# /.row #}
+ {% include "app/scorecard/_secondary_answers.html" %}
+
+ {# /isDatetimeUnit(practice) #}
+ {# End of details section #}
+
+
+ {# /v-for=getEntries() #}
+
+ {# /v-if=itemsLoaded && items.results.length > 0 #}
+
+ {% if not sample.is_frozen %}
+
+ {% if segments_candidates and (not urls.assess_mandatory_segment or is_mandatory_segment_present) %}
+
+
+
+ {% trans %}Add industry-specific
+ assessment{% endtrans %}
+
+
+
+ {% endif %}
+
{# /#add-segments-actions #}
+ {% endif %}
+
+ {# /# details #}
+ {#
#}
+ {# #}
+ {##}
+ {# #}
+ {#
#}
+ {# {% if sample.is_frozen %}#}
+ {# actions only available when a scorecard is frozen #}
+ {# {% if urls.share %}#}
+ {#
#}
+ {# XXX disabled until functionality is implemented #}
+ {#
#}
+ {# {% endif %}#}
+ {# {% else %}#}
+ {# actions only available when a scorecard is active #}
+ {#
#}
+ {#
#}
+ {# {% if not urls.assess_mandatory_segment or is_mandatory_segment_present %}#}
+ {#
#}
+ {# #}
+ {# #}
+ {# {% trans %}Complete{% endtrans %}#}
+ {# #}
+ {# #}
+ {#
#}
+ {# {% trans %}You can only record a response once all#}
+ {# sections have#}
+ {# been answered. Required questions with missing#}
+ {# answers are#}
+ {# highlighted with a red vertical bar to the#}
+ {# right.{% endtrans %}#}
+ {#
#}
+ {# {% endif %}#}
+ {#
#}
+ {# {% endif %}#}
+ {#
#}
+ {# #}
+ {# /#next-actions #}
+
+
+ {% include "app/_reset_assessment.html" %}
+ {% include "app/_complete_assessment.html" %}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/djaopsp/templates/base.html b/djaopsp/templates/base.html
index 93ea7c95..89b094a0 100644
--- a/djaopsp/templates/base.html
+++ b/djaopsp/templates/base.html
@@ -35,6 +35,7 @@
+ {% block supercontent %}
{% block dashboard_nav %}
@@ -152,6 +153,7 @@
+ {% endblock %}
diff --git a/djaopsp/urls/views/reports.py b/djaopsp/urls/views/reports.py
index 0ad3c1f5..0b403c07 100644
--- a/djaopsp/urls/views/reports.py
+++ b/djaopsp/urls/views/reports.py
@@ -12,6 +12,7 @@
from ...views.downloads import ImproveContentPDFView
from ...views.scorecard import (ScorecardIndexView, ScorecardHistoryView,
ScorecardRedirectView, DataValuesView)
+from ...views.assess_scorecard import AssessScorecardView
from ...views.share import ShareView, ShareRedirectView
@@ -33,6 +34,9 @@
AssessPracticesView.as_view(), name='assess_practices'),
path('assess//',
AssessRedirectView.as_view(), name='assess_redirect'),
+ path('assess2///',
+ AssessScorecardView.as_view(), name='assess_scorecard'),
+
# Target and improvement plan
path('improve//print/',
ImproveContentPDFView.as_view(), name='improve_print'),
diff --git a/djaopsp/views/assess_scorecard.py b/djaopsp/views/assess_scorecard.py
new file mode 100644
index 00000000..84e9f058
--- /dev/null
+++ b/djaopsp/views/assess_scorecard.py
@@ -0,0 +1,138 @@
+import logging
+
+from deployutils.apps.django.templatetags.deployutils_prefixtags import (
+ site_url)
+from deployutils.helpers import update_context_urls
+from django.db.models import Q
+from django.views.generic.base import TemplateView
+from survey.models import Answer
+from survey.settings import DB_PATH_SEP
+from survey.utils import get_question_model
+
+from ..compat import reverse
+from ..mixins import SectionReportMixin
+from ..utils import get_highlights, get_summary_performance
+
+LOGGER = logging.getLogger(__name__)
+
+from survey.models import Choice
+
+
+class AssessScorecardView(SectionReportMixin, TemplateView):
+ """
+ Profile scorecard page
+ """
+ template_name = 'app/assess_scorecard/index.html'
+ URL_PATH_SEP = '/'
+ breadcrumb_url = 'assess_practices'
+
+ def get_reverse_kwargs(self):
+ """
+ List of kwargs taken from the url that needs to be passed through
+ to ``reverse``.
+ """
+ return [self.account_url_kwarg, self.sample_url_kwarg,
+ self.path_url_kwarg]
+
+ @property
+ def campaign_mandatory_segments(self):
+ # pylint:disable=attribute-defined-outside-init
+ if not hasattr(self, '_campaign_mandatory_segments'):
+ self._campaign_mandatory_segments = []
+ campaign_slug = self.sample.campaign.slug
+ campaign_prefix = "%s%s%s" % (
+ DB_PATH_SEP, campaign_slug, DB_PATH_SEP)
+ if get_question_model().objects.filter(
+ path__startswith=campaign_prefix).exists():
+ self._campaign_mandatory_segments = [campaign_prefix]
+ return self._campaign_mandatory_segments
+
+ @property
+ def is_mandatory_segment_present(self):
+ # pylint:disable=attribute-defined-outside-init
+ if not hasattr(self, '_is_mandatory_segment_present'):
+ filter_args = None
+ for seg_path in self.campaign_mandatory_segments:
+ if filter_args:
+ filter_args |= Q(question__path__startswith=seg_path)
+ else:
+ filter_args = Q(question__path__startswith=seg_path)
+ self._is_mandatory_segment_present = False
+ if filter_args:
+ queryset = Answer.objects.filter(
+ filter_args, sample=self.sample)
+ self._is_mandatory_segment_present = queryset.exists()
+ return self._is_mandatory_segment_present
+
+ def get_template_names(self):
+ candidates = ['app/scorecard/%s.html' % self.sample.campaign]
+ candidates += super(AssessScorecardView, self).get_template_names()
+ return candidates
+
+ def get_context_data(self, **kwargs):
+ context = super(AssessScorecardView, self).get_context_data(**kwargs)
+ context.update({
+ 'prefix': self.full_path,
+ 'nb_answers': self.nb_answers,
+ 'nb_questions': self.nb_questions,
+ 'units': {},
+ 'verification_enabled': self.account in self.verifier_accounts,
+ 'highlights': get_highlights(self.sample),
+ 'is_mandatory_segment_present': self.is_mandatory_segment_present,
+ 'summary_performance': get_summary_performance(
+ self.improvement_sample)
+ })
+
+ for unit_slug in ('verifiability', 'supporting-document',
+ 'completeness'):
+ context['units'].update({
+ unit_slug.replace('-', '_'): Choice.objects.filter(
+ unit__slug=unit_slug).order_by('rank')})
+ if not self.sample.is_frozen:
+ context.update({
+ 'nb_required_answers': self.nb_required_answers,
+ 'nb_required_questions': self.nb_required_questions,
+ })
+ if not self.segments_available:
+ update_context_urls(context, {
+ 'complete': "#" # When there are no answers yet, we want
+ # to show the assess step on the scorecard.
+ })
+ if self.campaign_mandatory_segments:
+ update_context_urls(context, {
+ 'assess_mandatory_segment': reverse('assess_practices',
+ args=(self.account, self.sample, self.sample.campaign)),
+ })
+ update_context_urls(context, {
+ 'pages_index': reverse('pages_index'),
+ 'scorecard_download': reverse('assess_download',
+ args=(self.account, self.sample)),
+ 'survey_api_sample_answers': reverse('api_sample_content',
+ args=(self.account, self.sample, '-'))[:-2],
+ 'api_account_benchmark': reverse(
+ 'survey_api_sample_benchmarks_index',
+ args=(self.account, self.sample)),
+ 'assess_base': reverse('assess_practices',
+ args=(self.sample.account, self.sample, '-'))[:-2],
+ 'api_assessment_freeze': reverse('survey_api_sample_freeze_index',
+ args=(self.sample.account, self.sample)),
+ 'api_assessment_reset': reverse('survey_api_sample_reset_index',
+ args=(self.sample.account, self.sample)),
+ 'api_assessment_notes': reverse('api_verifier_notes_index',
+ args=(self.sample.account, self.sample)),
+ 'api_asset_upload_complete': self.request.build_absolute_uri(
+ reverse('pages_api_upload_asset', args=(self.sample.account,))),
+ 'track_metrics_index': reverse(
+ 'track_metrics_index', args=(self.account,)),
+ 'api_profiles': site_url("/api/accounts/users"),
+ 'api_content': reverse('api_sample_content',
+ args=(self.account, self.sample,
+ self.full_path.lstrip(self.URL_PATH_SEP))),
+ 'api_assessment_sample': reverse('survey_api_sample',
+ args=(self.account, self.sample)),
+ 'api_aggregate_metric_base': reverse(
+ 'survey_api_aggregate_metric_base', args=(self.account,)),
+ 'api_asset_upload_start': self.request.build_absolute_uri(
+ reverse('pages_api_upload_asset', args=(self.account,))),
+ })
+ return context