CSC/ECE 517 Spring 2018- Project E1810: Show sample submissions and reviews

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

Expertiza is a web based open source peer reviewing tool developed and maintained by current and past students of North Carolina State University. Peer review is a great way for a student to learn how to approach a project and get ideas for their own projects. Currently, there is no way for a student to view another student's work, unless they are reviewing the other student's work.

Problem Statement

The objective of this project is to:

  1. Add a feature to allow teams to publish their work for other students to see.
  2. Add a feature for a student to view sample submissions for a given assignment made available by other students:
    1. In the same assignment, available after deadline.
    2. In an old assignment, selected by the instructor from sample submissions made in an old assignment.
  3. Add a feature for instructor to select a previous assignment to show sample submissions for a new assignment.

Proposed Design

The proposed features will involve two kinds of users : Students and Instructors. Students will use the application to make their submissions public and view published reviews.

Instructors will use the application to make submissions from a previous assignment available as sample submissions for a current assignment. Only those submissions will be visible which were previously made public by the students.

Project Tasks

The tasks that need to be completed as part of this project can be listed as follows:

  1. Add checkbox against each assignment in student_tasks/list view to allow student to publish their work
  2. Add column make_public to table teams for storing user permission (published or not) for each project.
  3. Add controller for Sample submissions and implement corresponding methods.
  4. Add views for sample submissions
  5. Make changes to page student_task/view which would have link to sample submissions for each project.
  6. Add drop down in assignments/edit/_general view.
  7. Add controller code for the drop down.
  8. Add column sample_assignment_id to table assignment.
  9. Add test scripts for all the functionality.

Current status of Development

All tasks mentioned in Project tasks are completed.

Developed Code

1. Add checkbox against each assignment in student_tasks/list view to allow student to publish their work

<% if !participant.team.nil? %>
    <td align=center>
        <input id="makeSubPublic" teamid="<%= participant.team.id %>" type="checkbox" onclick="publishConfirmation(this)" <% if participant.team.make_public %>checked<% end %>>
    </td>
<% end %>

2. Add column make_public to table teams for storing user permission (published or not) for each project.

class AddSampleAssignmentToAssignments < ActiveRecord::Migration
  def change
    add_column :assignments, :sample_assignment_id, :integer, index: true
    add_foreign_key :assignments, :assignments, column: :sample_assignment_id
  end
end

3. Add controller for Sample submissions and implement corresponding methods.

# To give permission for making a submission available to others
  def make_public
    @team = Team.find(params[:id])
    @team.make_public = params[:status]
    @team.save
    respond_to do |format|
      format.html { head :no_content }
    end
  end

4. Add views for sample submissions

<!-- View to display sample submissions to the student -->
<h2>Sample Submissions for <%= @assignment.name%>:</h2>
<br>
<!-- Displaying sample submissions by students of the current course -->
<h3>Submissions made public by peers:</h3>
<% if @assignment_due_date==nil or @assignment_due_date>Time.new() %>
    <br><i>Will be available once the assignment submission is completed</i>
<% elsif @assignment_teams==[] %>
    <br><i>No sample submissions from current assignment made public yet</i>
<% else %>
    <ul>
      <% @assignment_teams.each do |assignment_team| %>
          <% if assignment_team.hyperlinks != [] %>
              <li>
                <ul>
                  <h4>Team name : <%=assignment_team.name%></h4>
                  <% assignment_team.hyperlinks.each do |assignment_link| %>
                      <li><a href="<%=assignment_link%>"><%=assignment_link%></a></li>
                  <%end%>
                </ul>
              </li>
          <%end%>
      <% end%>
    </ul>
<% end %>
<br>
<hr/>
<br>

<!-- Displaying sample submissions from a previous assignment chosen by the instructor -->
<h3>Submissions made public by instructor:</h3>
<% if @assignment_teams_professor == [] %>
    <br><i>No sample submissions from previous assignments made available yet</i>
<% else %>
    <ul>
      <% @assignment_teams_professor.each do |assignment_team| %>
          <% if assignment_team.hyperlinks != [] %>
              <ul>
                <li>
                  <h4>Team name : <%=assignment_team.name%></h4>
                  <% assignment_team.hyperlinks.each do |assignment_link| %>
                    <li><a href="<%=assignment_link%>"><%=assignment_link%></a></li>
                <%end%>
                </li>
              </ul>
          <%end%>
      <% end%>
    </ul>
<% end %>
<br><br>

<a href="javascript:window.history.back()">Back</a>

5. Make changes to page student_task/view which would have link to sample submissions for each project.

<li>
  <%= link_to "Sample Submissions", controller: 'sample_submissions', :action => 'index', :id => @assignment.id %>
    (View sample work submitted by other participants/teams)
</li>

6. Add drop down in assignments/edit/_general view.

<!-- Adding sample submissions for students to refer to -->
  <tr>
    <td style='padding:5px'><%= label_tag('assignment_form[assignment][sample_assignment_id]', 'Sample Assignment:') %>
      <img src="/assets/info.png" title='- Select an assignment that students can refer sample submission from.'>
    </td>
    <td style='padding:5px'><%= select('assignment_form[assignment]', 'sample_assignment_id', sample_sub_options, :selected => @assignment_form.assignment.sample_assignment_id) %> 
    </td>
  </tr>

7. Add controller code for the drop down.

   def sample_sub_options
    assignments = Assignment.all
    options = []
    assignments.each do |assignment|
      course_name = ""
      if assignment.course_id and assignment.course_id != 0 and !Course.find(assignment.course_id).nil?
        course_name = Course.find(assignment.course_id).name
      end
      options << [course_name + '- ' + assignment.name, assignment.id]
    end
    options.uniq.sort
    options.unshift(['-----------', nil])
  end

8. Add column sample_assignment_id to table assignment.

class AddSampleAssignmentToAssignments < ActiveRecord::Migration
  def change
    add_column :assignments, :sample_assignment_id, :integer, index: true
    add_foreign_key :assignments, :assignments, column: :sample_assignment_id
  end
end

9. Add test scripts for all the functionality.

def create_assignment_team(assignment_name, parent_id)
  assignment_team = AssignmentTeam.new
  assignment_team.name = assignment_name
  assignment_team.parent_id = parent_id
  assignment_team.save!
end

def init_test
  # create assignment and topic
  assignment = build(Assignment)
  course = Course.new
  course.name = "SampleSubmissionTestCourse"
  course.save
  assignment.course_id = course.id
  assignment.save

  create_assignemnt_team("ss_assignment_team_1", assignment.id)
  create_assignemnt_team("ss_assignment_team_2", assignment.id)
end

def visit_sample_submissions_page
  visit '/student_task/list'
  click_on "Example Assignment"
  click_on "Sample Submissions"
end

describe "sample submission test" do
  before(:each) { init_test }

  it "is able to make an assignment public" do
    visit '/student_task/list'
    find(:css, "#makeSubPublic[teamid='6050']").trigger("click")
    click_button 'OK'
    expect(page).to have_http_status(200)
  end

  it "should not see current assignment submissions if deadline is not met" do # Set deadline after current time.
    visit_sample_submissions_page
    expect(page).to have_content "No sample submissions from current assignment made public yet"
  end

  it "should see current assignment submissions if deadline is met" do # Set deadline before current time.
    visit_sample_submissions_page
    expect(page).to_not have_content "No sample submissions from current assignment made public yet"
  end

  it "should not see instructor selected submissions if instructor has not selected them" do
    visit_sample_submissions_page
    expect(page).to have_content "No sample submissions from previous assignment made available yet"
  end

  it "should see instructor selected submissions if instructor has selected them" do # Instructor makes submission available.
    visit_sample_submissions_page
    expect(page).to_not have_content "No sample submissions from previous assignment made available yet"
  end
end

Sample Submissions View

1. The first screenshot of the application is taken when the deadline for the current assignment has not crossed and the instructor also has not given any sample assignment for this assignment.

2. The second screenshot of the application is taken when the deadline for the current assignment has not crossed but the instructor has selected a sample assignment for viewing against this assignment.

3. The third screenshot of the application is taken when both the deadline for the current assignment has crossed and the instructor has selected a sample assignment for viewing.

Test Plan

Many of our changes are reflected on views (user interface). So we build tests with rspec/capybara. Following is the list of tests that conduct:

  1. it "is able to make an assignment public"
  2. it "is able to view sample submissions page"
  3. it "should not see current assignment submissions if deadline is not met"
  4. it "should see current assignment submissions if deadline is met"
  5. it "should not see instructor selected submissions if instructor has not selected them"
  6. it "should see instructor selected submissions if instructor has selected them"
def create_assignment_team(assignment_name, parent_id)
  assignment_team = AssignmentTeam.new
  assignment_team.name = assignment_name
  assignment_team.parent_id = parent_id
  assignment_team.save!
end

def init_test
  # create assignment and topic
  assignment = build(Assignment)
  course = Course.new
  course.name = "SampleSubmissionTestCourse"
  course.save
  assignment.course_id = course.id
  assignment.save

  create_assignemnt_team("ss_assignment_team_1", assignment.id)
  create_assignemnt_team("ss_assignment_team_2", assignment.id)
end

def visit_sample_submissions_page
  visit '/student_task/list'
  click_on "Example Assignment"
  click_on "Sample Submissions"
end

describe "sample submission test" do
  before(:each) { init_test }

  it "is able to make an assignment public" do
    visit '/student_task/list'
    find(:css, "#makeSubPublic[teamid='6050']").trigger("click")
    click_button 'OK'
    expect(page).to have_http_status(200)
  end

  it "should not see current assignment submissions if deadline is not met" do # Set deadline after current time.
    visit_sample_submissions_page
    expect(page).to have_content "No sample submissions from current assignment made public yet"
  end

  it "should see current assignment submissions if deadline is met" do # Set deadline before current time.
    visit_sample_submissions_page
    expect(page).to_not have_content "No sample submissions from current assignment made public yet"
  end

  it "should not see instructor selected submissions if instructor has not selected them" do
    visit_sample_submissions_page
    expect(page).to have_content "No sample submissions from previous assignment made available yet"
  end

  it "should see instructor selected submissions if instructor has selected them" do # Instructor makes submission available.
    visit_sample_submissions_page
    expect(page).to_not have_content "No sample submissions from previous assignment made available yet"
  end
end

Future Scope

  1. Publishing sample reviews made by students: This feature will require students to allow their review to be published as a sample review. This can then be made available to future students.

External Links

  1. link to forked repository [1]
  2. link to the git pull request [2]
  3. link to the deployed application [3]

References

  1. Link to expertiza website: [4]