Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add progress blocks visualization to the student overview #407

Draft
wants to merge 49 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
266f385
initial refactoring of submitting
stgm Jan 9, 2020
0980229
Merge branch 'master' into new_submissions_system
stgm Jan 9, 2020
72c10c7
ch
stgm Jan 9, 2020
6db770c
fix
stgm Jan 9, 2020
857baa1
fix
stgm Jan 9, 2020
3fd13db
move components into features folder
stgm Jan 9, 2020
f168c84
Merge branch 'master' into new_submissions_system
stgm Jan 10, 2020
360afa5
Merge branch 'master' into new_submissions_system
stgm Jan 13, 2020
084f887
Merge branch 'master' into new_submissions_system
stgm Jan 13, 2020
5bc53f8
Merge branch 'master' into new_submissions_system
stgm Jan 13, 2020
f72e257
Merge branch 'master' into new_submissions_system
stgm Jan 13, 2020
cd10cfe
clean up submit model
stgm Jan 14, 2020
80c04de
cleanup
stgm Jan 14, 2020
4cc7fea
refactoring
stgm Jan 14, 2020
4d74f7d
update user last submit time on each submit
stgm Jan 15, 2020
83bdb4b
bugfix
stgm Jan 15, 2020
4e7e533
add grading details to modal grade viewer
stgm Jan 15, 2020
04c6d65
deleting grades
stgm Jan 15, 2020
8cb5516
admin can't always change schedule
stgm Jan 15, 2020
79f9c88
add modal browser to schedules and grading views
stgm Jan 15, 2020
e8c26a5
fix brand
stgm Jan 20, 2020
e7edc8c
brand
stgm Jan 21, 2020
2894b55
brand
stgm Jan 21, 2020
6f477f6
always do grade calculations
stgm Jan 22, 2020
4a27ebc
reorganize features
stgm Jan 22, 2020
f91c83c
fix student modal view
stgm Jan 22, 2020
72f16ea
allow strings
stgm Jan 23, 2020
e80e52f
recheck
stgm Jan 23, 2020
86d8248
blocks
stgm Jan 23, 2020
fad4cdf
cosmetics
stgm Jan 23, 2020
98af8d2
dates
stgm Jan 23, 2020
09c74b3
cosmetics
stgm Jan 23, 2020
4452179
cosmetics
stgm Jan 23, 2020
011dfaa
cosmetics
stgm Jan 23, 2020
3a8882e
cosmetics
stgm Jan 23, 2020
d8752e6
submits
stgm Jan 24, 2020
4c1790b
testing
stgm Jan 25, 2020
e44c5ae
testing
stgm Jan 25, 2020
53ecc70
testing
stgm Jan 25, 2020
3377098
testing
stgm Jan 25, 2020
0bdd2bb
testing
stgm Jan 25, 2020
b570fac
add some caching
stgm Jan 26, 2020
f262b1f
more
stgm Jan 26, 2020
aa961e8
more
stgm Jan 26, 2020
b9037e9
touch on grade
stgm Jan 27, 2020
3273f7e
show design
stgm Jan 29, 2020
bd8a33d
Merge branch 'master' into blocks
stgm Jan 30, 2020
c6355d0
bugfix
stgm Jan 30, 2020
b567d70
Merge branch 'main' into blocks
stgm Jul 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions app/assets/stylesheets/includes/elements.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,65 @@ span.bubble {
border-radius: 5px;
}

//****************************************************************************

.blockgraph
{
margin: 0.5rem 0;
display: flex;
flex-flow: row wrap;
align-content: flex-start;
}

.blockgraph .block
{
width: 1.5rem;
height: 1rem;
margin-bottom: 0.4rem;
line-height:0.9;
text-align:center;
color:white;
cursor: pointer;
}

.blockgraph.small .block
{
width: 0.5rem;
}


.block + .weekend
{
// margin-left: 0.1rem;
}

.weekend + .weekend
{
margin-left: 0rem;
margin-right: 0.4rem;
}


.strength-0 { background-color: #EFEFEF;}
.strength-1 { background-color: #DFDFDF;}
.strength-2 { background-color: #CFCFCF;}
.strength-3 { background-color: #c0c0c0;}
.strength-4 { background-color: #B1B1B1;}
.strength-5 { background-color: #A3A3A3;}
.strength-6 { background-color: #949494;}
.strength-7 { background-color: #878787;}
.strength-8 { background-color: #797979;}

.interesting.strength-0 { background-color: #EF7700;}
.interesting.strength-1 { background-color: #DD6E00;}
.interesting.strength-2 { background-color: #CE6700;}
.interesting.strength-3 { background-color: #bf5f00;}
.interesting.strength-4 { background-color: #AF5700;}
.interesting.strength-5 { background-color: #A35100;}
.interesting.strength-6 { background-color: #934900;}
.interesting.strength-7 { background-color: #874300;}
.interesting.strength-8 { background-color: #773b00;}

#files
{
padding-top:0.35rem;
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def html_tag_with_language(&block)
end

def date_span_with_title(date)
"<span title=\"#{date.strftime("%A %d %b %Y %R")}\">#{time_ago_in_words(date)} #{t(:ago)}</span>".html_safe
"<span title=\"#{l date, format: :long}\">#{l date, format: :short}</span>".html_safe
end

def markdown(text, page_context)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/navigation_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def next_module
end

def user_designation
@user_designation ||= current_user.group_name || current_user.schedule_name if Schedule.count > 1
@user_designation ||= current_user.group_name || current_user.schedule_name
end

def alerts_for_current_schedule
Expand Down
36 changes: 36 additions & 0 deletions app/helpers/progress_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module ProgressHelper

def course_dates
if Settings.course_start_date.present? and Settings.course_end_date.present?
return Settings.course_start_date..Settings.course_end_date
else
return AttendanceRecord.order(:cutoff).first.cutoff.to_date..AttendanceRecord.order(:cutoff).last.cutoff.to_date
end
end

def progress_bar(user, items, **args)
@grouped_items = items.group_by_day{ |i| i.class==Submit && i.submitted_at || i.updated_at }
@xtra = user.submits.where("submitted_at is not null").to_a.group_by_day{|i| i.created_at}
# @xtra.each { |k,v| puts k; puts v }
# puts "---"


@grouped_items.merge!(@xtra) { |k,v1,v2| puts k; puts v1; puts v2; v1 + v2 }
# puts @grouped_items
# @grouped_items.each { |k,v| puts k; puts v }

tag.div class: "blockgraph #{args} #{args[:class]}" do
@attendance = user.attendance_by_day
@attendance.default = 0
course_dates.each do |date|
@day_items = @grouped_items.select{|k,v| k==date}.collect{|k,v| v.collect{|ai| ai.short_description}}.flatten
concat tag.div((@day_items.join =~ /submit/ && 's' || ''), class: "block strength-#{[@attendance[date],8].min} #{@day_items.any? && 'interesting' || ''} #{!(1..5).include?(date.wday) && 'weekend' || ''}", data: { toggle: 'tooltip', placement: 'top' }, title: "#{date} (#{@attendance[date]}) #{@day_items}")
end
end
end

# def submits(user_submits)
#
# end

end
8 changes: 6 additions & 2 deletions app/models/grade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Grade < ApplicationRecord

belongs_to :submit, touch: true

has_one :user, through: :submit
has_one :user, through: :submit, touch: true
delegate :name, to: :user, prefix: true, allow_nil: true

has_one :pset, through: :submit
Expand Down Expand Up @@ -133,7 +133,11 @@ def grade=(new_grade)
end
end
end


def short_description
"#{pset_name} graded"
end

def config
grading_config = Settings['grading']
return grading_config && grading_config['grades'] && grading_config['grades'][self.pset_name]
Expand Down
4 changes: 4 additions & 0 deletions app/models/hand.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def user_last_seen
nil
end
end

def short_description
"1 question asked and answered"
end

def sortable_date
updated_at
Expand Down
6 changes: 5 additions & 1 deletion app/models/note.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
class Note < ApplicationRecord

belongs_to :student, class_name: "User"
belongs_to :student, class_name: "User", touch: true
belongs_to :author, class_name: "User"
delegate :name, to: :author, prefix: true, allow_nil: true

after_create do |note|
note.student.increment! :notes_count if !note.log
end

def short_description
"1 note written"
end

def sortable_date
updated_at
end
Expand Down
4 changes: 4 additions & 0 deletions app/models/submit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ def recheck(host)
self.update(check_token: token)
end

def short_description
"#{pset_name} submitted"
end

def may_be_resubmitted?
grade.blank? || (grade.public? && grade.any_final_grade.present? && grade.any_final_grade == 0)
end
Expand Down
21 changes: 21 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,26 @@ def take_attendance
graph = user_attendance.map { |v| symbols[[v,7].min] }.join("")
self.update_attribute(:attendance, graph)
end

def attendance_by_day
records = attendance_records.group_by_day(:cutoff).count#.to_a

# if records.any?
# first_day = records.first.first
# last_day = records.last.first
#
# first_day_of_week = first_day.beginning_of_week
# (first_day_of_week...first_day).each do |day|
# records << [day,0]
# end
#
# today = Date.today
# (last_day+1..today).each do |day|
# records << [day,0]
# end
# end
#
# records.sort
end

end
6 changes: 5 additions & 1 deletion app/views/overviews/_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<th></th>

<th>Participation</th>

<th>Progress</th>

<% @psets.each do |pset| %>
<th>
Expand All @@ -11,7 +13,7 @@
<% end %>
</tr>

<% users.each do |group, user_list|%>
<% @users.each do |group, user_list|%>
<tr>
<th class="py-2" colspan="2">
<% if group %>
Expand Down Expand Up @@ -51,6 +53,8 @@
<%= user.hands_duration_count %> mins
</td>

<td style="white-space:nowrap"><%= progress_bar(user, user.items, class: 'small') %></td>

<%
subs = user.submits.group_by(&:pset_id)
%>
Expand Down
2 changes: 1 addition & 1 deletion app/views/overviews/group.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= render partial: 'tabs' %>
<%= render partial: 'overview_table', locals: { users: @users, psets: @psets } %>
<%= render partial: 'overview_table', locals: { groups: @groups, psets: @psets } %>

<script type="text/javascript" charset="utf-8">
enableTooltips();
Expand Down
2 changes: 1 addition & 1 deletion app/views/overviews/schedule.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= render partial: 'tabs' %>
<%= render partial: 'table', locals: { users: @users, psets: @psets } %>
<%= render partial: 'table', locals: { groups: @groups, psets: @psets } %>

<script type="text/javascript" charset="utf-8">
enableTooltips();
Expand Down
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ en:
cancel_request: "Cancel request"
link: "Provide your Zoom link"
in_line: "We ask that you wait a bit because you were helped just recently!"
time:
formats:
default: "%a %d %b %Y %H:%M:%S %Z"
long: "%A %d %B %Y %H:%M"
short: "%A %d %b %H:%M"
6 changes: 3 additions & 3 deletions config/locales/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ nl:
materials: "materialen"
modules: "modules"
other: "overig"
you_submitted: "Je hebt %{name} ingestuurd"
submit: "Insturen"
you_submitted: "Je hebt %{name} ingezonden"
you_submitted_ago: "Je hebt deze opdracht %{time} geleden ingestuurd."
see_submissions_page: "Zie de voortgangspagina voor een overzicht."
files_submitted: "Ingestuurde bestanden:"
Expand Down Expand Up @@ -262,6 +262,6 @@ nl:
am: "'s ochtends"
formats:
default: "%a %d %b %Y %H:%M:%S %Z"
long: "%d %B %Y %H:%M"
short: "%d %b %H:%M"
long: "%A %d %B %Y %H:%M"
short: "%A %d %b %H:%M"
pm: "'s middags"