feat: fix links between browse and analyze pages

mciea-main
rebuilt 9 months ago
parent 204e9c1b3a
commit 48bf32abae

@ -44,12 +44,12 @@ class ParentScalePresenter
scale.measure
end
private
def scale_id
scale.scale_id
end
private
def parent_survey_presenter
ParentSurveyPresenter.new(scale_id:, survey_items: scale.survey_items.parent_survey_items,
has_sufficient_data: score.positive?, school:, academic_year:)

@ -1,49 +1,49 @@
<g class="grouped-bar-column" data-for-measure-id="<%= column.measure.measure_id %>">
<% score_label_y = [5, 10, 15, 5, 10, 15 ] %>
<% column.bars.each_with_index do |bar, index| %>
<rect
<% if column.show_popover? %>
data-bs-toggle="popover"
data-bs-placement="right"
data-bs-content="<%= column.popover_content(bar.academic_year) %>"
<% end %>
<% score_label_y = [5, 10, 15, 5, 10, 15 ] %>
<% column.bars.each_with_index do |bar, index| %>
<rect
<% if column.show_popover? %>
data-bs-toggle="popover"
data-bs-placement="right"
data-bs-content="<%= column.popover_content(bar.academic_year) %>"
<% end %>
data-for-academic-year="<%= bar.academic_year.range %>"
x="<%= bar.x_position %>%"
y="<%= bar.y_offset %>%"
width="<%= column.bar_width %>%"
height="<%= bar.bar_height_percentage %>%"
fill="<%= bar.color %>" />
data-for-academic-year="<%= bar.academic_year.range %>"
x="<%= bar.x_position %>%"
y="<%= bar.y_offset %>%"
width="<%= column.bar_width %>%"
height="<%= bar.bar_height_percentage %>%"
fill="<%= bar.color %>" />
<% if ENV["SCORES"].present? && ENV["SCORES"].upcase == "SHOW" %>
<text x="<%= bar.x_position + (column.bar_width * 0.5) %>%" y="<%= score_label_y[index] %>%" text-anchor="middle" dominant-baseline="middle">
<%= bar.average %>
<% if ENV["SCORES"].present? && ENV["SCORES"].upcase == "SHOW" %>
<text x="<%= bar.x_position + (column.bar_width * 0.5) %>%" y="<%= score_label_y[index] %>%" text-anchor="middle" dominant-baseline="middle">
<%= bar.average %>
</text>
<% end %>
<% end %>
<line x1="<%= column.column_start_x %>%" y1="0" x2="<%= column.column_start_x %>%" y2="85%" stroke="grey" stroke-width="1" stroke-dasharray="5,2" />
<% words = column.label %>
<% words.each_with_index do | line, index | %>
<text class="graph-footer" x="<%= column.column_midpoint %>%" y="<%= column.bar_label_height + (index * 5) %>%" text-anchor="middle" dominant-baseline="middle" data-grouped-bar-label="<%= column.label %>">
<% words = column.label %>
<% words.each_with_index do | line, index | %>
<text class="graph-footer" x="<%= column.column_midpoint %>%" y="<%= column.bar_label_height + (index * 5) %>%" text-anchor="middle" dominant-baseline="middle" data-grouped-bar-label="<%= column.label %>">
<%= line %>
</text>
</text>
<% end %>
<% if column.show_irrelevancy_message? %>
<rect x="<%= column.message_x %>%" y="<%= column.message_y %>%" rx="15" ry="15" width="<%= column.message_width %>%" height="<%= column.message_height %>%" fill="white" stroke="gray" />
<text x="<%= column.column_midpoint %>%" y="<%= 20 %>%" text-anchor="middle">
<tspan x="<%= column.column_midpoint %>%" y="29%">measure not</tspan>
<tspan x="<%= column.column_midpoint %>%" y="34%">based on</tspan>
<tspan x="<%= column.column_midpoint %>%" y="39%"><%= column.basis %></tspan>
<text x="<%= column.column_midpoint %>%" y="<%= 20 %>%" text-anchor="middle">
<tspan x="<%= column.column_midpoint %>%" y="29%">measure not</tspan>
<tspan x="<%= column.column_midpoint %>%" y="34%">based on</tspan>
<tspan x="<%= column.column_midpoint %>%" y="39%"><%= column.basis %></tspan>
</text>
<% elsif column.show_insufficient_data_message? %>
<rect x="<%= column.message_x %>%" y="<%= column.message_y %>%" rx="15" ry="15" width="<%= column.message_width %>%" height="<%= column.message_height %>%" fill="white" stroke="gray" />
<text x="<%= column.column_midpoint %>%" y="<%= 20 %>%" text-anchor="middle">
<% column.insufficiency_message.each_with_index do |line, index| %>
<% offset = 29 + index * 5 %>
<tspan x='<%= column.column_midpoint %>%' y='<%= offset %>%'><%= line %></tspan>
<% end %>
<text x="<%= column.column_midpoint %>%" y="<%= 20 %>%" text-anchor="middle">
<% column.insufficiency_message.each_with_index do |line, index| %>
<% offset = 29 + index * 5 %>
<tspan x='<%= column.column_midpoint %>%' y='<%= offset %>%'><%= line %></tspan>
<% end %>
</text>
<% end %>
</g>

@ -27,10 +27,10 @@
<% if @presenter.show_secondary_graph?(measure:) %>
<section class="mb-6">
<% measure.scales.parent_scales.each do | scale| %>
<label id="<%= scale.scale_id %>" hidden> </label>
<% measure.scales.parent_scales.each do |scale| %>
<label id="<%= scale.scale_id %>" > </label>
<% end %>
<%= link_to("Parent Survey", district_school_category_path( @district, @school, @presenter.category, {year: @presenter.selected_academic_years&.last&.range , anchor: "#{measure.measure_id}"}), class: "construct-id", data: {turbo_frame: "_top"}) %>
<%= link_to("Parent Survey", district_school_category_path( @district, @school, @presenter.category, {year: @presenter.selected_academic_years&.last&.range , anchor: "#{measure.scales.parent_scales.first.scale_id}"}), class: "construct-id", data: {turbo_frame: "_top"}) %>
<h2> <%= measure.subcategory.name %> </h2>
<%= render partial: "grouped_bar_chart" , locals: { measure: measure, columns: @presenter.columns_for_measure(measure:)} %>
</section>

@ -1,4 +1,4 @@
<div id="<%= measure_presenter.id %>" class="measure-section mx-4">
<div id="<%= id %>" class="measure-section mx-4">
<p class="construct-id"><%= measure_presenter.title %></p>
<%= link_to(district_school_analyze_index_path(@district, @school, { academic_year: @academic_year.range, category: measure_presenter.measure.subcategory.category.category_id, subcategory: measure_presenter.measure.subcategory.subcategory_id, anchor: measure_presenter.id}), class: "measure-description sub-header-4 mb-5") do %>
<h3 class="measure-description sub-header-4 mb-5 "><%= measure_presenter.name %></h3>

@ -50,14 +50,14 @@
<div class="measure-card d-flex p-7">
<% subcategory.measure_presenters.each do |measure_presenter| %>
<%= render partial: "measures_section", locals: { measure_presenter: measure_presenter } %>
<%= render partial: "measures_section", locals: { measure_presenter: measure_presenter, id: measure_presenter.id } %>
<% end %>
</div>
<% if subcategory.show_scale_presenters? %>
<div class="scale-card d-flex p-7">
<% subcategory.scale_presenters.each do |scale_presenter| %>
<%= render partial: "measures_section", locals: { measure_presenter: scale_presenter } %>
<%= render partial: "measures_section", locals: { measure_presenter: scale_presenter, id: "#{scale_presenter.scale_id}" } %>
<% end %>
</div>
<% end %>

Loading…
Cancel
Save