CSC/ECE 517 Spring 2017/oss E1727: Difference between revisions
Line 126: | Line 126: | ||
* | * | ||
==Running the Project | ==Running the Project Remotely== | ||
We have hosted our forked repo so you can review our changes here: | |||
http://138.197.104.185:3000/ | |||
Suggested login for Instructor privileges is 'instructor6' with password 'password'. To login as a student, you can use 'student5000' with password 'password' | |||
==Testing using Selenium IDE== | ==Testing using Selenium IDE== |
Revision as of 21:29, 22 March 2017
Introduction
This project was completed as part of a greater open source project called Expertiza.
Expertiza is a web application platform, similar to wikipedia, which offers teachers and students a way to organize for group assignments and porjects. By using Expertiza, students have the ability to submit and coordinate peer-review learning objects (articles, code, web sites, etc). The Expertiza project is supported by the National Science Foundation.
Expertiza offers several features which are useful to a classroom-style learning environment. Among those several features, this project represents a contribution to the organization of the code used for assignment signup sheets.
Background
The work for this project was completed by a group of three students from NC State. However, the project was completed according to guidelines provided by a coordinator who works with Expertiza.
Following the guidelines provided, the group worked to clean up a portion of the Expertiza project code through refactorization and reorganization. More specifically, logical code needed to be separated from portions of the project which were not responsible for containing code for the functionality of the application.
Motivation
The motivation for this project was to make the project code easier for programmers to read by compartmentalizing portions of the code to separate locations in the project according to the functionality of the code.
The scope of this project was limited to functionalities associated with the signup sheet. This meant that logical code that was embedded in "view" (a folder containing html formatting and design code) should be moved to a more appropriate location, the "helpers" folder (this folder contains compartmentalized auxiliary functions that "help" with other parts of the project).
Tasks Identified
Documents: _add_signup_topics.html.erb, _due_dates.html.erb
- Move javascript code to assets (folder): There was some javascript at the bottom of the file _add_signup_topics.html.erb. This was moved to a new file app/assets/javascripts/signup.js. The functions were modified to pass in the number of teams that needed to be toggled (since it is now in a separate file without access to that information). The javascript from the file _due_dates.html.erb was also moved to the new signup.js file.
This functionality can be tested by logging in as an instructor, make sure you are managing assignments, then click the "Edit" button of an assignment (the little pencil icon on the right), then choose the "Topic" tab. If you click "Hide all teams" link, all team names and team member unity ids will be hidden. Click the link again and the content will be shown. If you click individual top names, it should hide/show only one team's info.
Documents: _suggested_topic.html.erb, intelligent_topic_selection.html.erb
- Move logical code to helper file and assign self-explanatory method names.
Documents: _all_actions.html.erb, _topic_names.html.erb
- Move logical code to helper file and assign self-explanatory method names.
Testing:
- Create a test file named sign_up_sheet_helper_spec.rb in spec/helpers
- Write test cases for all methods in sign_up_sheet_helper.rb using factories
Classes
- sign_up_sheet_helper.rb
- sign_up_sheet_helper_spec.rb
Project Modifications
New Method: check_topic_due_date_value()
def check_topic_due_date_value(assignment_due_dates, topic_id, deadline_type_id = 1, review_round = 1) due_date = get_topic_deadline(assignment_due_dates, topic_id, deadline_type_id, review_round) DateTime.parse(due_date.to_s).strftime("%Y-%m-%d %H:%M").in_time_zone end
New Method: get_topic_deadline()
def get_topic_deadline(assignment_due_dates, topic_id, deadline_type_id = 1, review_round = 1) topic_due_date = TopicDueDate.where(parent_id: topic_id, deadline_type_id: deadline_type_id, round: review_round).first rescue nil if !topic_due_date.nil? topic_due_date.due_at else assignment_due_dates[review_round - 1].due_at.to_s end end
New Method: get_suggested_topics()
def get_suggested_topics(assignment_id) team_id = TeamsUser.team_id(assignment_id, session[:user].id) teams_users = TeamsUser.where(team_id: team_id) teams_users_array = Array.new teams_users.each do |teams_user| teams_users_array << teams_user.user_id end @suggested_topics = SignUpTopic.where(assignment_id: assignment_id, private_to: teams_users_array) end
New Method: get_intelligent_topic_row()
def get_intelligent_topic_row(topic, selected_topics) row_html = '' if !selected_topics.nil? && selected_topics.size != 0 for selected_topic in @selected_topics if selected_topic.topic_id == topic.id and !selected_topic.is_waitlisted row_html = '<tr bgcolor="yellow">' elsif selected_topic.topic_id == topic.id and selected_topic.is_waitlisted row_html = '<tr bgcolor="lightgray">' else row_html = '<tr id="topic_"' + topic.id.to_s + '>' end end else row_html = '<tr id="topic_"' + topic.id.to_s + ' style="background-color:' + get_topic_bg_color(topic) + '">' end row_html.html_safe end
New Method: get_topic_bg_color()
def get_topic_bg_color(topic) 'rgb(' + (400*(1-(Math.tanh(2*[@max_team_size.to_f/Bid.where(topic_id:topic.id).count,1].min-1)+1)/2)) .to_i.to_s + ',' + (400*(Math.tanh(2*[@max_team_size.to_f/Bid.where(topic_id:topic.id). count,1].min-1)+1)/2).to_i.to_s + ',0)' end
New Method: render_participant_info()
def render_participant_info(topic, assignment, participants) name_html = '' if !participants.nil? && participants.size > 0 chooser_present = false for participant in @participants if topic.id == participant.topic_id chooser_present = true if assignment.max_team_size > 1 name_html += '<br/><b>' + participant.team_name_placeholder + '</b><br/>' end name_html += 'participant.user_name_placeholder' if participant.is_waitlisted name_html += '<font color="red">(waitlisted)</font>' end name_html += '<br/>' end end unless chooser_present name_html += 'No choosers.' end end name_html.html_safe end
Changes to the View
Impact Analysis
Affected Classes
Running the Project Remotely
We have hosted our forked repo so you can review our changes here:
Suggested login for Instructor privileges is 'instructor6' with password 'password'. To login as a student, you can use 'student5000' with password 'password'