CSC/ECE 517 Spring 2017/oss E1729

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

This project was an addendum to the bigger Expertiza project. The Expertiza project is software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages.

The requirement for this OSS project was to 'Export Scores In Detail'

Deployment Link

http://152.46.16.143:3000

Branch on Git

The branch on which we developed this project on is called 'exportdetail'

Problem Statement

Expertiza provides a the ability for an instructor to export scores for an assignment. Whenever a user fill out teammate reviews, peer reviews, feedback reviews, and etc. the scores for each question on those reviews is stored in the database. Currently however Expertiza only exports a csv with aggregated scores which are computed as weighted averages of the scores given in reviews. This is not the most helpful for visualizing the score data by question, individual team/user, reviewer. So it was our assignment to implement the ability to export a more detailed csv that contained all the scores for each question for each review and review type within a specific assignment.

Part of the implementation includes the ability to choose the delimiter for the csv and specify which columns they wanted to include.

Design

Implementation

Files Updated

  • app/controllers/export_file_controller.rb
  • app/models/assignment.rb
  • app/views/export_file/start.html.erb

Files Added

  • app/views/export_file/_export_details.html.erb
  • spec/controllers/export_file_controller_spec.rb
  • spec/features/assignment_export_details/expected_details_csv.txt

Code Snippets

export_file_controller_spec.rb

def exportdetails
    @delim_type = params[:delim_type2]
    if @delim_type == "comma"
      filename = params[:model] + params[:id] + "_Details.csv"
      delimiter = ","
    elsif @delim_type == "space"
      filename = params[:model] + params[:id] + "_Details.csv"
      delimiter = " "
    elsif @delim_type == "tab"
      filename = params[:model] + params[:id] + "_Details.csv"
      delimiter = "\t"
    elsif @delim_type == "other"
      filename = params[:model] + params[:id] + "_Details.csv"
      delimiter = other_char2
    end
    allowed_models = ['Assignment']
    csv_data = CSV.generate(col_sep: delimiter) do |csv|
     if allowed_models.include? params[:model]
        csv << Object.const_get(params[:model]).export_Headers(params[:id])
        csv << Object.const_get(params[:model]).export_details_fields(params[:details])
        Object.const_get(params[:model]).export_details(csv, params[:id], params[:details])
     end
    end
   
    send_data csv_data,
              type: 'text/csv; charset=iso-8859-1; header=present',
        disposition: "attachment; filename=#{filename}"

  end

Test Plan