Skip to content

Commit

Permalink
Fixed David's PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
devan-srinivasan committed Jul 9, 2021
1 parent f322d62 commit 8ccccdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 5 additions & 5 deletions app/assets/javascripts/Components/dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class Dashboard extends React.Component {
method: 'GET',
success: (data) => {
// Load in background colours
for(let j = 0; j < data["datasets"].length; j++){
data["datasets"][j]["backgroundColor"] = colours[j]
for (const [index, element] of data["datasets"].entries()){
element["backgroundColor"] = colours[index]
}
this.setState({
data: data,
Expand Down Expand Up @@ -75,7 +75,7 @@ class Dashboard extends React.Component {
if (this.state.display_course_summary) {
// TODO
} else if (this.state.assessment_type === 'GradeEntryForm') {
this.getGradeEntryFormColumnBreakdown()
this.getGradeEntryFormColumnBreakdown();
} else if (this.state.assessment_type === 'Assignment') {
// TODO
}
Expand All @@ -90,9 +90,9 @@ class Dashboard extends React.Component {
} else if (this.state.assessment_type === 'GradeEntryForm') {
return (
<div>
<Bar data={this.state.data} />;
<Bar data={this.state.data} />
<Bar data={this.state.data}
options={this.state.options}/>;
options={this.state.options}/>

</div>
);
Expand Down
6 changes: 2 additions & 4 deletions app/controllers/grade_entry_forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,10 @@ def view_summary
# (see the second chart in the summary of a marks spreadsheet, accessed from the dashboard)
def column_breakdown
grade_entry_form = GradeEntryForm.find(params[:id])
grade_entry_items = grade_entry_form.grade_entry_items
return_data = { labels: [], datasets: [] }
axis_labels = (0..100).step(5).to_a
dict_data = []
grade_entry_items.each do |item|
dict_data << { label: item.name, data: item.grade_distribution_array(20), backgroundColor: '' }
dict_data = grade_entry_form.grade_entry_items.map do |item|
{ label: item.name, data: item.grade_distribution_array(20), backgroundColor: '' }
end
return_data[:labels], return_data[:datasets] = axis_labels, dict_data
respond_to do |format|
Expand Down

0 comments on commit 8ccccdd

Please sign in to comment.