Skip to content

Commit

Permalink
add icon, color reminder and the specification of the tetrahydron. Th…
Browse files Browse the repository at this point in the history
…e visualization of that page included
  • Loading branch information
LeoHsuProgrammingLab committed Oct 19, 2024
1 parent 70d149b commit c6f1d57
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 117 deletions.
80 changes: 80 additions & 0 deletions rails_root/app/assets/stylesheets/show.css
Original file line number Diff line number Diff line change
@@ -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;
}
16 changes: 10 additions & 6 deletions rails_root/app/helpers/survey_responses_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit c6f1d57

Please sign in to comment.