From c6f1d57d4e613ff9ec4712db7c036eeb72e79648 Mon Sep 17 00:00:00 2001 From: Leo Hsu Date: Fri, 18 Oct 2024 19:28:04 -0500 Subject: [PATCH] add icon, color reminder and the specification of the tetrahydron. The visualization of that page included --- rails_root/app/assets/stylesheets/show.css | 80 +++++++ .../app/helpers/survey_responses_helper.rb | 16 +- .../app/views/survey_responses/show.html.erb | 217 +++++++++--------- rails_root/features/data_submission.feature | 1 - 4 files changed, 197 insertions(+), 117 deletions(-) create mode 100644 rails_root/app/assets/stylesheets/show.css diff --git a/rails_root/app/assets/stylesheets/show.css b/rails_root/app/assets/stylesheets/show.css new file mode 100644 index 0000000..e7b389e --- /dev/null +++ b/rails_root/app/assets/stylesheets/show.css @@ -0,0 +1,80 @@ +.section-header { + cursor: pointer; + user-select: none; +} + +.section-header h4:before { + content: '\25B6'; + font-size: .85em; + min-width: 1.5rem; +} + +.section-header[aria-expanded="true"] h4:before { + content: '\25BC'; + font-size: .85em; + min-width: 1.5rem; +} + +tr { + transition: height 0.0s ease; +} + +tr.collapsing { + height: auto; + transition: height 0.0s ease; +} + +.table-slight-red { + background-color: #ffffff; /* Light red */ + color: black; +} + +.table-mild-red { + background-color: #ff9999; /* Mild red */ + color: black; +} + +.table-medium-red { + background-color: #ff6666; /* Medium red */ + color: white; +} + +.table-strong-red { + background-color: #ff3333; /* Strong red */ + color: white; +} + +/* Center text in table headers and cells */ +/* table th, table td { + text-align: center; + vertical-align: middle; +} */ + +/* Align the first column to the left */ +table td:first-child { + text-align: left; +} + +/* Optional: Adjust the padding for better spacing */ +.table th, .table td { + padding: 10px; +} + +/* Icon styles */ +.icon { + font-size: 1.5em; +} + +/* Optional styling for the invitation link */ +#invitation-link-container { + margin-top: 20px; +} + +#invitation-link { + font-weight: bold; + color: #007bff; /* Bootstrap primary color */ +} + +#invitation-link:hover { + text-decoration: underline; +} \ No newline at end of file diff --git a/rails_root/app/helpers/survey_responses_helper.rb b/rails_root/app/helpers/survey_responses_helper.rb index ebd11c1..27da55c 100644 --- a/rails_root/app/helpers/survey_responses_helper.rb +++ b/rails_root/app/helpers/survey_responses_helper.rb @@ -95,13 +95,16 @@ def get_teacher_part_difference(response) 0 else difference = 0 + nonempty_answers = answers.select { |ans| !ans.choice.nil? } - answers.each do |x| + nonempty_answers.each do |x| teacher_choice = teacher_answers[x.question_id] difference += (x.choice - teacher_choice).abs unless teacher_choice.nil? end - (difference.to_f / answers.length).round + length = nonempty_answers.length - teacher_answers.select { |_, v| v.nil? }.length + + (difference.to_f / length).round end end end @@ -122,13 +125,14 @@ def get_part_difference(response, other) 0 else difference = 0 - - answers.each do |x| + nonempty_answers = answers.select { |ans| !ans.choice.nil? } + nonempty_answers.each do |x| other_choice = other_answers.detect { |y| x.question_id == y.question_id } - difference += (x.choice - other_choice.choice).abs unless other_choice.nil? + difference += (x.choice - other_choice.choice).abs unless (other_choice.nil?) end - (difference.to_f / answers.length).round + length = nonempty_answers.length - other_answers.select { |ans| ans.choice.nil? }.length + (difference.to_f / length).round end end end diff --git a/rails_root/app/views/survey_responses/show.html.erb b/rails_root/app/views/survey_responses/show.html.erb index 9a25c5f..5c4aff5 100644 --- a/rails_root/app/views/survey_responses/show.html.erb +++ b/rails_root/app/views/survey_responses/show.html.erb @@ -1,123 +1,108 @@ -

<%= notice %>

-<%# FIXME: Move this to a stylesheet when we have time %> - - -<%# FIXME: A lot of the logic in this view should not be done in here %> - <% superintendent_response = find_superintendent(@survey_response)%> <% teacher_average = average_of_teachers(@survey_response)%> <% combined_view = @survey_response.profile.role == 'Principal' && !(teacher_average.nil? && superintendent_response.nil?) %> -<% colors = ["table-success", "table-warning", "table-warning", "table-danger"] %> +<% colors = ["table-slight-red", "table-mild-red", "table-medium-red", "table-strong-red"] %> +<% difference_text = ["Synergized", "Slightly Misaligned", "Misaligned", "Severely Misaligned"] %> +<% value_text = ["(1) Leadership", "(2) External Forces", "(3) Organizational Structure", "(4) Values, Attributes, and Beliefs"] %>
<% if combined_view %> -

Your Represented Synergy

-
-
-
-
- <% difference_text = ["Synergized", "Slightly Misaligned", "Misaligned", "Severely Misaligned"] %> - <% value_text = ["Leadership", "External Forces", "Organizational Structure", "Values, Attributes, and Beliefs"] %> - - <% unless superintendent_response.nil? %> - <% superintendent_alignment = get_part_difference(@survey_response, superintendent_response) %> - <% end %> - - <% unless teacher_average.nil? %> - <% teacher_alignment = get_teacher_part_difference(@survey_response) %> - <% end %> + <%# Synergy Header %> +

Your Represented Synergy

+
+
+

+ This tetrahedron represents the alignment of the four factors based on your leadership behaviors to align the four factors. +

+
+
+
vs. Superintendent Review
+
vs. Teacher Review
+
-
-
- - - - - <% unless superintendent_response.nil? %> - - <% end %> + <% unless superintendent_response.nil? %> + <% superintendent_alignment = get_part_difference(@survey_response, superintendent_response) %> + <% end %> - <% unless teacher_average.nil? %> - - <% end %> - - - - <% value_text.each_with_index do |value, idx| %> + <% unless teacher_average.nil? %> + <% teacher_alignment = get_teacher_part_difference(@survey_response) %> + <% end %> + + <%# Synergy Table %> +
+
+
ValueSuperintendentTeachers
+ - + <% unless superintendent_response.nil? %> - <% synergism = superintendent_alignment[idx] %> - + <% end %> <% unless teacher_average.nil? %> - <% synergism = teacher_alignment[idx] %> - + <% end %> + + + <% value_text.each_with_index do |value, idx| %> + + + <% unless superintendent_response.nil? %> + <% synergism = superintendent_alignment[idx] %> + + <% end %> + + <% unless teacher_average.nil? %> + <% synergism = teacher_alignment[idx] %> + + <% end %> + <% end %> - -
<%= value %>Key Factor - <%= difference_text[synergism] %> - Superintendent - <%= difference_text[synergism] %> - Teachers
+ <%# Add triangle icon with color based on index %> + + ▲ + + <%= value %> + +
<%= difference_text[synergism] %>
+
+
<%= difference_text[synergism] %>
+
+ + +
-
- <% else %> -

Synergistic Leadership Theory

- - <% if @survey_response.profile.role == 'Principal' %> - - <% end %> + <% else %> <%# No synergy view%> +

Synergistic Leadership Theory

+ <% if @survey_response.profile.role == 'Principal' %> + + <% end %> <% end %> + + <%# Research Explanation %>
<% if combined_view %> -

- This tetrahedron represents the alignment of the four factors based on your leadership behaviors to align the four factors. -

+

+ This tetrahedron represents the alignment of the four factors based on your leadership behaviors to align the four factors. +

<% end %>

The purpose of this qualitative study was to apply the Synergistic Leadership Theory (SLT) to the leadership experiences of five female superintendents leading successful school districts. The SLT is an interactive theory, which includes female experiences, but it applies to men and women. It provides a framework for leaders to align four factors that impact successful leadership: (a) attitudes, values, and beliefs; (b) leadership behaviors; (c) organizational structure; and (d) external forces. Four research questions guided my study: (a) What are the leadership behaviors of the superintendents? (b) Is the organizational structure of each district aligned with the superintendent’s leadership behaviors? (c) How do the leadership behaviors of the superintendent impact the relations between the district and the external forces? (d) Are the attitudes, values, and beliefs of the superintendent aligned to the attitudes, values, and beliefs of the school board member and the administrative team member

+
- <% choices = ["Strongly Disagree", "Disagree", "Agree", "Strongly Agree"] %> + <%# Survey Responses %> + <% choices = ["Strongly Disagree", "Disagree", "Agree", "Strongly Agree"] %> <% sections = @survey_response.questions.map(&:section).uniq %> <% answers = sections.map {|section| [section, @survey_response.answers.select {|ans| ans.question.section == section}]}.to_h%> +

@@ -214,7 +199,8 @@

- <%# this is the view containing the link %> + + <%# this is the view containing the invitation link %>