Skip to content

Commit

Permalink
Display submission version in gradebook (#2005)
Browse files Browse the repository at this point in the history
* First Commit: version info is on gradebook as new columns

* Second commit: only add a ver column after each assignment

* Delete database.docker.yml

* Delete schema.rb

* Deleted debug code

* change gitignore to original version

* Address nits

* Fix tooltips

* Simplify version logic

* Stop overwriting headerCssClass

* Fix tooltip for not_yet_submitted

* Handle nil aud

* Add version to gradebook CSV export

* Render tooltips onMouseEnter too

* Simplify version header

* Simplify logic

* Increase gradebook width

---------

Co-authored-by: SimonMen65 <[email protected]>
Co-authored-by: Simon Men <[email protected]>
  • Loading branch information
3 people authored Nov 15, 2023
1 parent f3e1bcb commit 5a0c3fc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 29 deletions.
18 changes: 6 additions & 12 deletions app/assets/javascripts/gradebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var slickgrid_options = {

case "not_yet_submitted":
if (columnDef.before_grading_deadline) {
value = "<a data-title='No submission has been made yet.' class='tip icon-exclamation-sign'></a>";
value = "<a data-tooltip='No submission has been made yet.' class='tooltipped icon-exclamation-sign'></a>";
} else {
tip = user + ' has not yet made any submissions for ' + asmt + '. ';
tip += 'The last date for submission by ' + user + ' is ' + data[end_at_key] + '.';
Expand Down Expand Up @@ -117,7 +117,6 @@ $(function () {

// column header tooltips
for (var i = 0; i < columns.length; i++) {
columns[i].headerCssClass = "tip";
columns[i].toolTip = columns[i].name;
}

Expand Down Expand Up @@ -164,18 +163,13 @@ $(function () {
});
$(window).resize();

grid.onMouseEnter.subscribe(function(e, args) {
$('.tooltipped', e.target).tooltip({
position: 'top',
delay: 100,
html: true
});
});

$('.tooltipped').tooltip({
const tooltipOpts = {
position: 'top',
delay: 100,
html: true
};
grid.onMouseEnter.subscribe(function(e, args) {
// Since Materialize's tooltip method was overwritten by jquery-ui
M.Tooltip.init(document.querySelectorAll(".tooltipped"), tooltipOpts);
});

})
11 changes: 1 addition & 10 deletions app/assets/stylesheets/instructor_gradebook.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ div#pageBody {
margin: 0 auto;
padding: 15px;
box-sizing: border-box;
max-width: 100%;
}

h1#courseTitle {
Expand Down Expand Up @@ -171,16 +172,6 @@ div#footer {
font-weight: bold;
}

#gradebook .slick-cell.assessment_final_score {
background: white;
}

#gradebook .slick-header-column.assessment_final_score {
background: #f3f3f3;
border-right: 1px solid #eaeaea;
color: #999;
}

#gradebook .slick-cell.computed {
color: #999;
}
Expand Down
17 changes: 14 additions & 3 deletions app/helpers/gradebook_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,19 @@ def gradebook_columns(matrix, course)
columns << { id: asmt.name, name: asmt.display_name, field: asmt.name,
sortable: true, cssClass: "computed assessment_final_score",
headerCssClass: "assessment_final_score",
before_grading_deadline: matrix.before_grading_deadline?(asmt.id) }
before_grading_deadline: matrix.before_grading_deadline?(asmt.id), width: 150 }

columns << { id: "#{asmt.name}_version", name: "Version",
field: "#{asmt.name}_version",
sortable: true, cssClass: "computed assessment_version",
headerCssClass: "assessment_version", width: 100 }
end

# category average column
columns << { id: cat, name: cat + " Average",
columns << { id: cat, name: "#{cat} Average",
field: "#{cat}_category_average",
sortable: true, cssClass: "computed category_average",
headerCssClass: "category_average", width: 100 }
headerCssClass: "category_average", width: 180 }
end

# course average column
Expand Down Expand Up @@ -90,6 +95,8 @@ def gradebook_rows(matrix, course, section = nil, lecture = nil)
next unless matrix.has_assessment? a.id

cell = matrix.cell(a.id, cud.id)
aud = a.assessment_user_data.find_by(course_user_datum_id: cud.id)
row["#{a.name}_version"] = aud&.latest_submission&.version
row["#{a.name}_history_url"] = history_url(cud, a)
row[a.name] = round cell["final_score"]
row["#{a.name}_submission_status"] = cell["submission_status"]
Expand Down Expand Up @@ -128,9 +135,12 @@ def csv_header(matrix, course)
header = %w(Email first_name last_name Lecture Section School Major Year grace_days_used penalty_late_days)
course.assessment_categories.each do |cat|
next unless matrix.has_category? cat

course.assessments_with_category(cat).each do |asmt|
next unless matrix.has_assessment? asmt.id

header << asmt.name
header << "version"
end
header << "#{cat} Average"
end
Expand Down Expand Up @@ -171,6 +181,7 @@ def gradebook_csv(matrix, course)
cell = matrix.cell(asmt.id, cud.id)

row << formatted_status(cell["status"])
row << cell["version"]
grace_days += cell["grace_days"]
late_days += cell["late_days"]
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/grade_matrix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def summarize(aud)
info = {}

info["status"] = aud.status @as_seen_by

info["version"] = aud.latest_submission&.version
info["final_score"] = aud.final_score @as_seen_by
info["grade_type"] = (AssessmentUserDatum.grade_type_to_sym aud.grade_type).to_s
info["submission_status"] = aud.submission_status.to_s
Expand Down
3 changes: 0 additions & 3 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ def self.roster_create(email, first_name, last_name, school, major, year)
user.password_confirmation = temp_pass
user.skip_confirmation!

Rails.logger.debug("user email: #{user.email}")
Rails.logger.debug("user pswd: #{user.password}")

user.save!
user
end
Expand Down

0 comments on commit 5a0c3fc

Please sign in to comment.