<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dcbharma</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dcbharma"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Dcbharma"/>
	<updated>2026-05-11T09:22:24Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121435</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121435"/>
		<updated>2018-12-09T00:00:47Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Code Change in Grades_Controller */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''Teammate Reviews''' under '''View Scores''' functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give a more realistic view of the work contribution of every team member using external tools like GitHub.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from GitHub. &lt;br /&gt;
&lt;br /&gt;
:1. '''Teammate Reviews''' functionality in the View Scores page gauges teammate views on how much other team members contributed to the project. We need to augment this data with data from external tools like GitHub in order to validate that feedback. New metrics will be appended under each student data under the same functionality.&lt;br /&gt;
:2. '''Github Metrics''' under '''View Submissions''' page should include a bar chart that shows number of commits by the team throughout the assignment timeline. This will help instructors to get a team overview, and aid grading process.&lt;br /&gt;
&lt;br /&gt;
While this data will not have marks associated directly, it will prove useful to the instructor in differentiating the performance of team members and hence awarding marks as per contribution. Overall data for the team, like the number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
Previously, view submission does not show work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows peer review amongst teammates. Currently, however, there is no way to validate and verify these reviews.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on GitHub is a solution, but that is inefficient from instructor's/reviewer's perspective as there are many assignments, submissions, and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
==='''Use Case Diagram'''===&lt;br /&gt;
[[File:UC_1.png|none|frame|1. Use Case diagram of two approaches to append 'GitHub contribution metric' in teammate review. 2. Use Case diagram explaining approach to add new column 'GitHub contribution metric' in 'View submission]]&lt;br /&gt;
&lt;br /&gt;
===='''Use Case Diagram Details'''====&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing, and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able to see the team contribution done by each team member in 'View Submissions' page using graph diagrams, as shown in the figure.&lt;br /&gt;
*Instructor will be able to see the work done by each student in 'Teammate Review Tab' with new metrics table appended at the end, as shown in the figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing our end-point for pulling GitHub data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Solution Design'''==&lt;br /&gt;
&lt;br /&gt;
* The Github metrics that need to be integrated with Expertiza were finalized as below. These metrics are captured on a per-user basis:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# Pull Request Status ( includes code climate and Travis CI Build status)&lt;br /&gt;
*#User Github metrics:&lt;br /&gt;
*## Committer ID&lt;br /&gt;
*## Committer Name&lt;br /&gt;
*## Committer email ID&lt;br /&gt;
	&lt;br /&gt;
* A new link &amp;quot;Github Metrics&amp;quot; is provided under “View Submissions” for an assignment in the instructor view.This link opens a new tab and shows a stacked bar chart for number of commits per user vs submission timeline from assignment creation date to the deadline.&lt;br /&gt;
* In &amp;quot;View Scores&amp;quot; for an assignment in the instructor view, under Teammate Reviews tab, a new table for Github Metrics is added, which shows following Github metrics per user:&lt;br /&gt;
:Student Name/ID, Email ID, lines of code added, lines of code deleted, number of commits&lt;br /&gt;
&lt;br /&gt;
* For GitHub integration, we have used GitHub GraphQL API v4. We have used OAuth gem for authentication purpose.&lt;br /&gt;
&lt;br /&gt;
* We parse the link to PR to get data associated with it. We have also handled projects which do not have PR link, but just a link to the repository.&lt;br /&gt;
&lt;br /&gt;
=='''Implemented Solution'''==&lt;br /&gt;
&lt;br /&gt;
==='''Files Modified'''===&lt;br /&gt;
&lt;br /&gt;
* app/controllers/auth_controller.rb&lt;br /&gt;
* app/controllers/grades_controller.rb&lt;br /&gt;
* app/helpers/grades_helper.rb&lt;br /&gt;
* app/views/assignments/list_submissions.html.erb&lt;br /&gt;
* app/views/grades/_tabbing.html.erb&lt;br /&gt;
* app/views/grades/_teammate_reviews_tab.html.erb&lt;br /&gt;
* app/views/grades/view.html.erb&lt;br /&gt;
* app/views/grades/view_team.html.erb&lt;br /&gt;
* config/application.rb&lt;br /&gt;
* config/initializers/load_config.rb&lt;br /&gt;
* config/initializers/omniauth.rb&lt;br /&gt;
* config/routes.rb&lt;br /&gt;
&lt;br /&gt;
==='''Files Added'''===&lt;br /&gt;
&lt;br /&gt;
* app/views/grades/view_github_metrics.html.erb&lt;br /&gt;
* config/github_auth.yml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''First Change'''===&lt;br /&gt;
&lt;br /&gt;
* A new table &amp;quot;Github Metrics&amp;quot; is added under Manage-&amp;gt; Assignments -&amp;gt; View Scores -&amp;gt; Teammate Reviews. Below is the screenshot of the implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter4.png|none|frame|The GitHub metrics table shows results for each team member]]&lt;br /&gt;
&lt;br /&gt;
==='''Second Change'''===&lt;br /&gt;
* The second change is in the View Submissions page, where we have added a link &amp;quot;Github Metrics&amp;quot; to a new page.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter3.png|none|frame|&lt;br /&gt;
At present, view submission shows group assignments are submitted as a single submission and 'view github metric' link shows work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
* The new page appears after clicking on the link &amp;quot;Github metrics&amp;quot;, that shows bar chart for # of commits per day. We have also added other relevant information about Pull Request, such as total commits, lines of code added, lines of code modified, PR merge status, check status.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_3.png|none|frame|The bar chart]]&lt;br /&gt;
[[File:Ooddafter10.png|none|frame|The Github summary]]&lt;br /&gt;
&lt;br /&gt;
===='''Code Change in Grades_Controller'''====&lt;br /&gt;
* Added below new functions to implement Github Integration in View Submission page&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def get_statuses_for_pull_request(ref)&lt;br /&gt;
    url = &amp;quot;https://api.github.com/repos/expertiza/expertiza/commits/&amp;quot; + ref + &amp;quot;/status&amp;quot;&lt;br /&gt;
    ActiveSupport::JSON.decode(Net::HTTP.get(URI(url)))&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_pull_request_data(pull_links)&lt;br /&gt;
    pull_links.each do |hyperlink|&lt;br /&gt;
      submission_hyperlink_tokens = hyperlink.split('/')&lt;br /&gt;
      hyperlink_data = {}&lt;br /&gt;
      hyperlink_data[&amp;quot;pull_request_number&amp;quot;] = submission_hyperlink_tokens.pop&lt;br /&gt;
      submission_hyperlink_tokens.pop&lt;br /&gt;
      hyperlink_data[&amp;quot;repository_name&amp;quot;] = submission_hyperlink_tokens.pop&lt;br /&gt;
      hyperlink_data[&amp;quot;owner_name&amp;quot;] = submission_hyperlink_tokens.pop&lt;br /&gt;
      github_data = get_pull_request_details(hyperlink_data)&lt;br /&gt;
      parse_github_data_pull(github_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_repository_data(repo_links)&lt;br /&gt;
    repo_links.each do |hyperlink|&lt;br /&gt;
      submission_hyperlink_tokens = hyperlink.split('/')&lt;br /&gt;
      hyperlink_data = {}&lt;br /&gt;
      hyperlink_data[&amp;quot;repository_name&amp;quot;] = submission_hyperlink_tokens[4]&lt;br /&gt;
      next if hyperlink_data[&amp;quot;repository_name&amp;quot;] == &amp;quot;servo&amp;quot; || hyperlink_data[&amp;quot;repository_name&amp;quot;] == &amp;quot;expertiza&amp;quot;&lt;br /&gt;
      hyperlink_data[&amp;quot;owner_name&amp;quot;] = submission_hyperlink_tokens[3]&lt;br /&gt;
      github_data = get_github_data_repo(hyperlink_data)&lt;br /&gt;
      parse_github_data_repo(github_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_github_data&lt;br /&gt;
    team_links = @team.hyperlinks&lt;br /&gt;
    pull_links = team_links.select do |link|&lt;br /&gt;
      link.match(/pull/) &amp;amp;&amp;amp; link.match(/github.com/)&lt;br /&gt;
    end&lt;br /&gt;
    if !pull_links.empty?&lt;br /&gt;
      retrieve_pull_request_data(pull_links)&lt;br /&gt;
    else&lt;br /&gt;
      repo_links = team_links.select do |link|&lt;br /&gt;
        link.match(/github.com/)&lt;br /&gt;
      end&lt;br /&gt;
      retrieve_repository_data(repo_links)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_check_run_statuses&lt;br /&gt;
    @head_refs.each do |pull_number, ref|&lt;br /&gt;
      @check_statuses[pull_number] = get_statuses_for_pull_request(ref)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def view_github_metrics&lt;br /&gt;
    if session[&amp;quot;github_access_token&amp;quot;].nil?&lt;br /&gt;
      session[&amp;quot;participant_id&amp;quot;] = params[:id]&lt;br /&gt;
      session[&amp;quot;github_view_type&amp;quot;] = &amp;quot;view_submissions&amp;quot;&lt;br /&gt;
      redirect_to authorize_github_grades_path&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @head_refs = {}&lt;br /&gt;
    @parsed_data = {}&lt;br /&gt;
    @authors = {}&lt;br /&gt;
    @dates = {}&lt;br /&gt;
    @total_additions = 0&lt;br /&gt;
    @total_deletions = 0&lt;br /&gt;
    @total_commits = 0&lt;br /&gt;
    @total_files_changed = 0&lt;br /&gt;
    @merge_status = {}&lt;br /&gt;
    @check_statuses = {}&lt;br /&gt;
&lt;br /&gt;
    @token = session[&amp;quot;github_access_token&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    @team_id = @team.id&lt;br /&gt;
&lt;br /&gt;
    retrieve_github_data&lt;br /&gt;
    retrieve_check_run_statuses&lt;br /&gt;
&lt;br /&gt;
    @authors = @authors.keys&lt;br /&gt;
    @dates = @dates.keys.sort&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def authorize_github&lt;br /&gt;
    redirect_to &amp;quot;https://github.com/login/oauth/authorize?client_id=#{GITHUB_CONFIG['client_key']}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def get_github_data_repo(hyperlink_data)&lt;br /&gt;
    data = {&lt;br /&gt;
      query: &amp;quot;query {&lt;br /&gt;
        repository(owner: \&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;owner_name&amp;quot;] + &amp;quot;\&amp;quot;, name: \&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;repository_name&amp;quot;] + &amp;quot;\&amp;quot;) {&lt;br /&gt;
          ref(qualifiedName: \&amp;quot;master\&amp;quot;) {&lt;br /&gt;
            target {&lt;br /&gt;
              ... on Commit {&lt;br /&gt;
                id&lt;br /&gt;
                  history(first: 100) {&lt;br /&gt;
                    edges {&lt;br /&gt;
                      node {&lt;br /&gt;
                        id author {&lt;br /&gt;
                          name email date&lt;br /&gt;
                        }&lt;br /&gt;
                      }&lt;br /&gt;
                    }&lt;br /&gt;
                  }&lt;br /&gt;
                }&lt;br /&gt;
              }&lt;br /&gt;
            }&lt;br /&gt;
          }&lt;br /&gt;
        }&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
    make_github_api_request(data)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def get_pull_request_details(hyperlink_data)&lt;br /&gt;
    response_data = make_github_api_request(get_query(true, hyperlink_data))&lt;br /&gt;
&lt;br /&gt;
    @has_next_page = response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;hasNextPage&amp;quot;]&lt;br /&gt;
    @end_cursor = response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;endCursor&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
    while @has_next_page&lt;br /&gt;
      new_response_data = make_github_api_request(get_query(false, hyperlink_data))&lt;br /&gt;
      response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;edges&amp;quot;].push(*new_response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;edges&amp;quot;])&lt;br /&gt;
      @has_next_page = new_response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;hasNextPage&amp;quot;]&lt;br /&gt;
      @end_cursor = new_response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;endCursor&amp;quot;]&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    response_data&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def process_github_authors_and_dates(author_name, commit_date)&lt;br /&gt;
    @authors[author_name] ||= 1&lt;br /&gt;
    @dates[commit_date] ||= 1&lt;br /&gt;
    @parsed_data[author_name] ||= {}&lt;br /&gt;
    @parsed_data[author_name][commit_date] = if @parsed_data[author_name][commit_date]&lt;br /&gt;
                                               @parsed_data[author_name][commit_date] + 1&lt;br /&gt;
                                             else&lt;br /&gt;
                                               1&lt;br /&gt;
                                             end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def parse_github_data_pull(github_data)&lt;br /&gt;
    team_statistics(github_data)&lt;br /&gt;
    pull_request_object = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;]&lt;br /&gt;
    commit_objects = pull_request_object[&amp;quot;commits&amp;quot;][&amp;quot;edges&amp;quot;]&lt;br /&gt;
    commit_objects.each do |commit_object|&lt;br /&gt;
      commit = commit_object[&amp;quot;node&amp;quot;][&amp;quot;commit&amp;quot;]&lt;br /&gt;
      author_name = commit[&amp;quot;author&amp;quot;][&amp;quot;name&amp;quot;]&lt;br /&gt;
      commit_date = commit[&amp;quot;committedDate&amp;quot;].to_s&lt;br /&gt;
      process_github_authors_and_dates(author_name, commit_date[0, 10])&lt;br /&gt;
    end&lt;br /&gt;
    organize_commit_dates&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def parse_github_data_repo(github_data)&lt;br /&gt;
    commit_history = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;ref&amp;quot;][&amp;quot;target&amp;quot;][&amp;quot;history&amp;quot;]&lt;br /&gt;
    commit_objects = commit_history[&amp;quot;edges&amp;quot;]&lt;br /&gt;
    commit_objects.each do |commit_object|&lt;br /&gt;
      commit_author = commit_object[&amp;quot;node&amp;quot;][&amp;quot;author&amp;quot;]&lt;br /&gt;
      author_name = commit_author[&amp;quot;name&amp;quot;]&lt;br /&gt;
      commit_date = commit_author[&amp;quot;date&amp;quot;].to_s&lt;br /&gt;
      process_github_authors_and_dates(author_name, commit_date[0, 10])&lt;br /&gt;
    end&lt;br /&gt;
    organize_commit_dates&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def make_github_api_request(data)&lt;br /&gt;
    uri = URI.parse(&amp;quot;https://api.github.com/graphql&amp;quot;)&lt;br /&gt;
    http = Net::HTTP.new(uri.host, uri.port)&lt;br /&gt;
    http.use_ssl = true&lt;br /&gt;
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER&lt;br /&gt;
    request = Net::HTTP::Post.new(uri.path, 'Authorization' =&amp;gt; 'Bearer' + ' ' + session[&amp;quot;github_access_token&amp;quot;])&lt;br /&gt;
    request.body = data.to_json&lt;br /&gt;
    http.request(request)&lt;br /&gt;
    response = http.request(request)&lt;br /&gt;
    ActiveSupport::JSON.decode(response.body.to_s)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def organize_commit_dates&lt;br /&gt;
    @dates.each_key do |date|&lt;br /&gt;
      @parsed_data.each_value do |commits|&lt;br /&gt;
        commits[date] ||= 0&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    @parsed_data.each {|author, commits| @parsed_data[author] = Hash[commits.sort_by {|date, _commit_count| date }] }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def team_statistics(github_data)&lt;br /&gt;
    @total_additions += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;additions&amp;quot;]&lt;br /&gt;
    @total_deletions += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;deletions&amp;quot;]&lt;br /&gt;
    @total_files_changed += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;changedFiles&amp;quot;]&lt;br /&gt;
    @total_commits += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;totalCount&amp;quot;]&lt;br /&gt;
    pull_request_number = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;number&amp;quot;]&lt;br /&gt;
    @head_refs[pull_request_number] = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;headRefOid&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
    @merge_status[pull_request_number] = if github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;merged&amp;quot;]&lt;br /&gt;
                                           &amp;quot;MERGED&amp;quot;&lt;br /&gt;
                                         else&lt;br /&gt;
                                           github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;mergeable&amp;quot;]&lt;br /&gt;
                                         end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def get_query(is_initial_page, hyperlink_data)&lt;br /&gt;
    commit_query_line = if is_initial_page&lt;br /&gt;
                          &amp;quot;commits(first:100){&amp;quot;&lt;br /&gt;
                        else&lt;br /&gt;
                          &amp;quot;commits(first:100, after:&amp;quot; + @end_cursor + &amp;quot;){&amp;quot;&lt;br /&gt;
                        end&lt;br /&gt;
    {&lt;br /&gt;
      query: &amp;quot;query {&lt;br /&gt;
        repository(owner: \&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;owner_name&amp;quot;] + &amp;quot;\&amp;quot;, name:\&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;repository_name&amp;quot;] + &amp;quot;\&amp;quot;) {&lt;br /&gt;
          pullRequest(number: &amp;quot; + hyperlink_data[&amp;quot;pull_request_number&amp;quot;] + &amp;quot;) {&lt;br /&gt;
            number additions deletions changedFiles mergeable merged headRefOid&lt;br /&gt;
              &amp;quot; + commit_query_line + &amp;quot;&lt;br /&gt;
                totalCount&lt;br /&gt;
                  pageInfo{&lt;br /&gt;
                    hasNextPage startCursor endCursor&lt;br /&gt;
                    }&lt;br /&gt;
                      edges{&lt;br /&gt;
                        node{&lt;br /&gt;
                          id  commit{&lt;br /&gt;
                                author{&lt;br /&gt;
                                  name&lt;br /&gt;
                                }&lt;br /&gt;
                               additions deletions changedFiles committedDate&lt;br /&gt;
                        }}}}}}}&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Change 1: GitHub metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate Reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data per team member based on different GitHub metrics (e.g.  lines of code added/changed/removed etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Change 2: Bar chart for # of commits changed by the overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Click on the &amp;quot;Github metrics&amp;quot; link for the team whose metrics you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A new page opens and shows # of commits changed per team member since the start of the assignment, also bottom of the page shows summary from Github submissions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Tests'''===&lt;br /&gt;
&lt;br /&gt;
* Following feature tests were added to the Grades_Controller_Spec.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
  describe '#get_statuses_for_pull_request' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(Net::HTTP).to receive(:get) {&amp;quot;{\&amp;quot;team\&amp;quot;:\&amp;quot;rails\&amp;quot;,\&amp;quot;players\&amp;quot;:\&amp;quot;36\&amp;quot;}&amp;quot;}&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'makes a call to the GitHub API to get status of the head commit passed' do&lt;br /&gt;
      expect(controller.get_statuses_for_pull_request('qwerty123')).to eq({&amp;quot;team&amp;quot; =&amp;gt; &amp;quot;rails&amp;quot;, &amp;quot;players&amp;quot; =&amp;gt; &amp;quot;36&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#retrieve_pull_request_data' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(controller).to receive(:get_pull_request_details).and_return({&amp;quot;pr&amp;quot; =&amp;gt; &amp;quot;details&amp;quot;})&lt;br /&gt;
      allow(controller).to receive(:parse_github_data_pull)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'gets pull request details for each PR link submitted' do&lt;br /&gt;
      expect(controller).to receive(:get_pull_request_details).with(&lt;br /&gt;
          {&lt;br /&gt;
              &amp;quot;pull_request_number&amp;quot; =&amp;gt; &amp;quot;1261&amp;quot;,&lt;br /&gt;
              &amp;quot;repository_name&amp;quot; =&amp;gt; &amp;quot;expertiza&amp;quot;,&lt;br /&gt;
              &amp;quot;owner_name&amp;quot; =&amp;gt; &amp;quot;expertiza&amp;quot;&lt;br /&gt;
          })&lt;br /&gt;
      expect(controller).to receive(:get_pull_request_details).with(&lt;br /&gt;
          {&lt;br /&gt;
              &amp;quot;pull_request_number&amp;quot; =&amp;gt; &amp;quot;1293&amp;quot;,&lt;br /&gt;
              &amp;quot;repository_name&amp;quot; =&amp;gt; &amp;quot;mamaMiya&amp;quot;,&lt;br /&gt;
              &amp;quot;owner_name&amp;quot; =&amp;gt; &amp;quot;Shantanu&amp;quot;&lt;br /&gt;
          })&lt;br /&gt;
      controller.retrieve_pull_request_data([&amp;quot;https://github.com/expertiza/expertiza/pull/1261&amp;quot;, &amp;quot;https://github.com/Shantanu/mamaMiya/pull/1293&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'calls parse_github_data_pull on each of the PR details' do&lt;br /&gt;
      expect(controller).to receive(:parse_github_data_pull).with({&amp;quot;pr&amp;quot; =&amp;gt; &amp;quot;details&amp;quot;}).twice&lt;br /&gt;
      controller.retrieve_pull_request_data([&amp;quot;https://github.com/expertiza/expertiza/pull/1261&amp;quot;, &amp;quot;https://github.com/Shantanu/mamaMiya/pull/1293&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#retrieve_repository_data' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(controller).to receive(:get_github_data_repo).and_return({&amp;quot;pr&amp;quot; =&amp;gt; &amp;quot;details&amp;quot;})&lt;br /&gt;
      allow(controller).to receive(:parse_github_data_repo)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'gets details for each repo link submitted, excluding those for expertiza and servo' do&lt;br /&gt;
      expect(controller).to receive(:get_github_data_repo).with(&lt;br /&gt;
          {&lt;br /&gt;
              &amp;quot;repository_name&amp;quot; =&amp;gt; &amp;quot;website&amp;quot;,&lt;br /&gt;
              &amp;quot;owner_name&amp;quot; =&amp;gt; &amp;quot;Shantanu&amp;quot;&lt;br /&gt;
          })&lt;br /&gt;
      expect(controller).to receive(:get_github_data_repo).with(&lt;br /&gt;
          {&lt;br /&gt;
              &amp;quot;repository_name&amp;quot; =&amp;gt; &amp;quot;OODD&amp;quot;,&lt;br /&gt;
              &amp;quot;owner_name&amp;quot; =&amp;gt; &amp;quot;Edward&amp;quot;&lt;br /&gt;
          })&lt;br /&gt;
      controller.retrieve_repository_data([&amp;quot;https://github.com/Shantanu/website&amp;quot;, &amp;quot;https://github.com/Edward/OODD&amp;quot;, &amp;quot;https://github.com/expertiza/expertiza&amp;quot;, &amp;quot;https://github.com/Shantanu/expertiza]&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'calls parse_github_data_repo on each of the PR details' do&lt;br /&gt;
      expect(controller).to receive(:parse_github_data_repo).with({&amp;quot;pr&amp;quot; =&amp;gt; &amp;quot;details&amp;quot;}).twice&lt;br /&gt;
      controller.retrieve_repository_data([&amp;quot;https://github.com/Shantanu/website&amp;quot;, &amp;quot;https://github.com/Edward/OODD&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#retrieve_github_data' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(controller).to receive(:retrieve_pull_request_data)&lt;br /&gt;
      allow(controller).to receive(:retrieve_repository_data)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when pull request links have been submitted' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        teams_mock = double&lt;br /&gt;
        allow(teams_mock).to receive(:hyperlinks).and_return([&amp;quot;https://github.com/Shantanu/website&amp;quot;, &amp;quot;https://github.com/Shantanu/website/pull/1123&amp;quot;])&lt;br /&gt;
        controller.instance_variable_set(:@team, teams_mock)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'retrieves PR data only' do&lt;br /&gt;
        expect(controller).to receive(:retrieve_pull_request_data).with([&amp;quot;https://github.com/Shantanu/website/pull/1123&amp;quot;])&lt;br /&gt;
        controller.retrieve_github_data&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when pull request links have not been submitted' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        teams_mock = double&lt;br /&gt;
        allow(teams_mock).to receive(:hyperlinks).and_return([&amp;quot;https://github.com/Shantanu/website&amp;quot;, &amp;quot;https://github.com/expertiza/expertiza&amp;quot;])&lt;br /&gt;
        controller.instance_variable_set(:@team, teams_mock)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'retrieves repo details ' do&lt;br /&gt;
        expect(controller).to receive(:retrieve_repository_data).with([&amp;quot;https://github.com/Shantanu/website&amp;quot;, &amp;quot;https://github.com/expertiza/expertiza&amp;quot;])&lt;br /&gt;
        controller.retrieve_github_data&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#retrieve_check_run_statuses' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(controller).to receive(:get_statuses_for_pull_request).and_return(&amp;quot;check_status&amp;quot;)&lt;br /&gt;
      controller.instance_variable_set(:@headRefs, {&amp;quot;1234&amp;quot; =&amp;gt; &amp;quot;qwerty&amp;quot;, &amp;quot;5678&amp;quot; =&amp;gt; &amp;quot;asdfg&amp;quot;})&lt;br /&gt;
      controller.instance_variable_set(:@check_statuses, {})&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'gets and stores the statuses associated with head commits of PRs' do&lt;br /&gt;
      expect(controller).to receive(:get_statuses_for_pull_request).with(&amp;quot;qwerty&amp;quot;)&lt;br /&gt;
      expect(controller).to receive(:get_statuses_for_pull_request).with(&amp;quot;asdfg&amp;quot;)&lt;br /&gt;
      controller.retrieve_check_run_statuses&lt;br /&gt;
      expect(controller.instance_variable_get(:@check_statuses)).to eq({&amp;quot;1234&amp;quot; =&amp;gt; &amp;quot;check_status&amp;quot;, &amp;quot;5678&amp;quot; =&amp;gt; &amp;quot;check_status&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view_github_metrics' do&lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'stores the current participant id and the view action' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(session[&amp;quot;participant_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_submissions&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when user has logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = &amp;quot;qwerty&amp;quot;&lt;br /&gt;
        allow(controller).to receive(:get_statuses_for_pull_request).and_return(&amp;quot;status&amp;quot;)&lt;br /&gt;
        allow(controller).to receive(:retrieve_github_data)&lt;br /&gt;
        allow(controller).to receive(:retrieve_check_run_statuses)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'stores the GitHub access token for later use' do&lt;br /&gt;
        get :view_github_metrics, {id: '1'}&lt;br /&gt;
        expect(controller.instance_variable_get(:@token)).to eq(&amp;quot;qwerty&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'calls retrieve_github_data to retrieve data from GitHub' do&lt;br /&gt;
        expect(controller).to receive(:retrieve_github_data)&lt;br /&gt;
        get :view_github_metrics, {id: '1'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'calls retrieve_check_run_statuses to retrieve check runs data' do&lt;br /&gt;
        expect(controller).to receive(:retrieve_check_run_statuses)&lt;br /&gt;
        get :view_github_metrics, {id: '1'}&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Change-log for Reviewers'''==&lt;br /&gt;
This section will be removed in the final draft. It is just here for convenience of reviewers to know which sections were majorly updated from last review.&lt;br /&gt;
&lt;br /&gt;
* '''Added''' Solution Design for the final implemented design&lt;br /&gt;
* '''Added''' Implemented Solution to show feature additions to Expertiza&lt;br /&gt;
* '''Added''' Feature test cases for Grades controller&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ GitHub API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121434</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121434"/>
		<updated>2018-12-09T00:00:19Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* RSpec Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''Teammate Reviews''' under '''View Scores''' functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give a more realistic view of the work contribution of every team member using external tools like GitHub.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from GitHub. &lt;br /&gt;
&lt;br /&gt;
:1. '''Teammate Reviews''' functionality in the View Scores page gauges teammate views on how much other team members contributed to the project. We need to augment this data with data from external tools like GitHub in order to validate that feedback. New metrics will be appended under each student data under the same functionality.&lt;br /&gt;
:2. '''Github Metrics''' under '''View Submissions''' page should include a bar chart that shows number of commits by the team throughout the assignment timeline. This will help instructors to get a team overview, and aid grading process.&lt;br /&gt;
&lt;br /&gt;
While this data will not have marks associated directly, it will prove useful to the instructor in differentiating the performance of team members and hence awarding marks as per contribution. Overall data for the team, like the number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
Previously, view submission does not show work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows peer review amongst teammates. Currently, however, there is no way to validate and verify these reviews.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on GitHub is a solution, but that is inefficient from instructor's/reviewer's perspective as there are many assignments, submissions, and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
==='''Use Case Diagram'''===&lt;br /&gt;
[[File:UC_1.png|none|frame|1. Use Case diagram of two approaches to append 'GitHub contribution metric' in teammate review. 2. Use Case diagram explaining approach to add new column 'GitHub contribution metric' in 'View submission]]&lt;br /&gt;
&lt;br /&gt;
===='''Use Case Diagram Details'''====&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing, and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able to see the team contribution done by each team member in 'View Submissions' page using graph diagrams, as shown in the figure.&lt;br /&gt;
*Instructor will be able to see the work done by each student in 'Teammate Review Tab' with new metrics table appended at the end, as shown in the figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing our end-point for pulling GitHub data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Solution Design'''==&lt;br /&gt;
&lt;br /&gt;
* The Github metrics that need to be integrated with Expertiza were finalized as below. These metrics are captured on a per-user basis:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# Pull Request Status ( includes code climate and Travis CI Build status)&lt;br /&gt;
*#User Github metrics:&lt;br /&gt;
*## Committer ID&lt;br /&gt;
*## Committer Name&lt;br /&gt;
*## Committer email ID&lt;br /&gt;
	&lt;br /&gt;
* A new link &amp;quot;Github Metrics&amp;quot; is provided under “View Submissions” for an assignment in the instructor view.This link opens a new tab and shows a stacked bar chart for number of commits per user vs submission timeline from assignment creation date to the deadline.&lt;br /&gt;
* In &amp;quot;View Scores&amp;quot; for an assignment in the instructor view, under Teammate Reviews tab, a new table for Github Metrics is added, which shows following Github metrics per user:&lt;br /&gt;
:Student Name/ID, Email ID, lines of code added, lines of code deleted, number of commits&lt;br /&gt;
&lt;br /&gt;
* For GitHub integration, we have used GitHub GraphQL API v4. We have used OAuth gem for authentication purpose.&lt;br /&gt;
&lt;br /&gt;
* We parse the link to PR to get data associated with it. We have also handled projects which do not have PR link, but just a link to the repository.&lt;br /&gt;
&lt;br /&gt;
=='''Implemented Solution'''==&lt;br /&gt;
&lt;br /&gt;
==='''Files Modified'''===&lt;br /&gt;
&lt;br /&gt;
* app/controllers/auth_controller.rb&lt;br /&gt;
* app/controllers/grades_controller.rb&lt;br /&gt;
* app/helpers/grades_helper.rb&lt;br /&gt;
* app/views/assignments/list_submissions.html.erb&lt;br /&gt;
* app/views/grades/_tabbing.html.erb&lt;br /&gt;
* app/views/grades/_teammate_reviews_tab.html.erb&lt;br /&gt;
* app/views/grades/view.html.erb&lt;br /&gt;
* app/views/grades/view_team.html.erb&lt;br /&gt;
* config/application.rb&lt;br /&gt;
* config/initializers/load_config.rb&lt;br /&gt;
* config/initializers/omniauth.rb&lt;br /&gt;
* config/routes.rb&lt;br /&gt;
&lt;br /&gt;
==='''Files Added'''===&lt;br /&gt;
&lt;br /&gt;
* app/views/grades/view_github_metrics.html.erb&lt;br /&gt;
* config/github_auth.yml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''First Change'''===&lt;br /&gt;
&lt;br /&gt;
* A new table &amp;quot;Github Metrics&amp;quot; is added under Manage-&amp;gt; Assignments -&amp;gt; View Scores -&amp;gt; Teammate Reviews. Below is the screenshot of the implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter4.png|none|frame|The GitHub metrics table shows results for each team member]]&lt;br /&gt;
&lt;br /&gt;
==='''Second Change'''===&lt;br /&gt;
* The second change is in the View Submissions page, where we have added a link &amp;quot;Github Metrics&amp;quot; to a new page.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter3.png|none|frame|&lt;br /&gt;
At present, view submission shows group assignments are submitted as a single submission and 'view github metric' link shows work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
* The new page appears after clicking on the link &amp;quot;Github metrics&amp;quot;, that shows bar chart for # of commits per day. We have also added other relevant information about Pull Request, such as total commits, lines of code added, lines of code modified, PR merge status, check status.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_3.png|none|frame|The bar chart]]&lt;br /&gt;
[[File:Ooddafter10.png|none|frame|The Github summary]]&lt;br /&gt;
&lt;br /&gt;
===='''Code Change in Grades_Controller'''====&lt;br /&gt;
Added below new functions to implement Github Integration in View Submission page&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def get_statuses_for_pull_request(ref)&lt;br /&gt;
    url = &amp;quot;https://api.github.com/repos/expertiza/expertiza/commits/&amp;quot; + ref + &amp;quot;/status&amp;quot;&lt;br /&gt;
    ActiveSupport::JSON.decode(Net::HTTP.get(URI(url)))&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_pull_request_data(pull_links)&lt;br /&gt;
    pull_links.each do |hyperlink|&lt;br /&gt;
      submission_hyperlink_tokens = hyperlink.split('/')&lt;br /&gt;
      hyperlink_data = {}&lt;br /&gt;
      hyperlink_data[&amp;quot;pull_request_number&amp;quot;] = submission_hyperlink_tokens.pop&lt;br /&gt;
      submission_hyperlink_tokens.pop&lt;br /&gt;
      hyperlink_data[&amp;quot;repository_name&amp;quot;] = submission_hyperlink_tokens.pop&lt;br /&gt;
      hyperlink_data[&amp;quot;owner_name&amp;quot;] = submission_hyperlink_tokens.pop&lt;br /&gt;
      github_data = get_pull_request_details(hyperlink_data)&lt;br /&gt;
      parse_github_data_pull(github_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_repository_data(repo_links)&lt;br /&gt;
    repo_links.each do |hyperlink|&lt;br /&gt;
      submission_hyperlink_tokens = hyperlink.split('/')&lt;br /&gt;
      hyperlink_data = {}&lt;br /&gt;
      hyperlink_data[&amp;quot;repository_name&amp;quot;] = submission_hyperlink_tokens[4]&lt;br /&gt;
      next if hyperlink_data[&amp;quot;repository_name&amp;quot;] == &amp;quot;servo&amp;quot; || hyperlink_data[&amp;quot;repository_name&amp;quot;] == &amp;quot;expertiza&amp;quot;&lt;br /&gt;
      hyperlink_data[&amp;quot;owner_name&amp;quot;] = submission_hyperlink_tokens[3]&lt;br /&gt;
      github_data = get_github_data_repo(hyperlink_data)&lt;br /&gt;
      parse_github_data_repo(github_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_github_data&lt;br /&gt;
    team_links = @team.hyperlinks&lt;br /&gt;
    pull_links = team_links.select do |link|&lt;br /&gt;
      link.match(/pull/) &amp;amp;&amp;amp; link.match(/github.com/)&lt;br /&gt;
    end&lt;br /&gt;
    if !pull_links.empty?&lt;br /&gt;
      retrieve_pull_request_data(pull_links)&lt;br /&gt;
    else&lt;br /&gt;
      repo_links = team_links.select do |link|&lt;br /&gt;
        link.match(/github.com/)&lt;br /&gt;
      end&lt;br /&gt;
      retrieve_repository_data(repo_links)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_check_run_statuses&lt;br /&gt;
    @head_refs.each do |pull_number, ref|&lt;br /&gt;
      @check_statuses[pull_number] = get_statuses_for_pull_request(ref)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def view_github_metrics&lt;br /&gt;
    if session[&amp;quot;github_access_token&amp;quot;].nil?&lt;br /&gt;
      session[&amp;quot;participant_id&amp;quot;] = params[:id]&lt;br /&gt;
      session[&amp;quot;github_view_type&amp;quot;] = &amp;quot;view_submissions&amp;quot;&lt;br /&gt;
      redirect_to authorize_github_grades_path&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @head_refs = {}&lt;br /&gt;
    @parsed_data = {}&lt;br /&gt;
    @authors = {}&lt;br /&gt;
    @dates = {}&lt;br /&gt;
    @total_additions = 0&lt;br /&gt;
    @total_deletions = 0&lt;br /&gt;
    @total_commits = 0&lt;br /&gt;
    @total_files_changed = 0&lt;br /&gt;
    @merge_status = {}&lt;br /&gt;
    @check_statuses = {}&lt;br /&gt;
&lt;br /&gt;
    @token = session[&amp;quot;github_access_token&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    @team_id = @team.id&lt;br /&gt;
&lt;br /&gt;
    retrieve_github_data&lt;br /&gt;
    retrieve_check_run_statuses&lt;br /&gt;
&lt;br /&gt;
    @authors = @authors.keys&lt;br /&gt;
    @dates = @dates.keys.sort&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def authorize_github&lt;br /&gt;
    redirect_to &amp;quot;https://github.com/login/oauth/authorize?client_id=#{GITHUB_CONFIG['client_key']}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def get_github_data_repo(hyperlink_data)&lt;br /&gt;
    data = {&lt;br /&gt;
      query: &amp;quot;query {&lt;br /&gt;
        repository(owner: \&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;owner_name&amp;quot;] + &amp;quot;\&amp;quot;, name: \&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;repository_name&amp;quot;] + &amp;quot;\&amp;quot;) {&lt;br /&gt;
          ref(qualifiedName: \&amp;quot;master\&amp;quot;) {&lt;br /&gt;
            target {&lt;br /&gt;
              ... on Commit {&lt;br /&gt;
                id&lt;br /&gt;
                  history(first: 100) {&lt;br /&gt;
                    edges {&lt;br /&gt;
                      node {&lt;br /&gt;
                        id author {&lt;br /&gt;
                          name email date&lt;br /&gt;
                        }&lt;br /&gt;
                      }&lt;br /&gt;
                    }&lt;br /&gt;
                  }&lt;br /&gt;
                }&lt;br /&gt;
              }&lt;br /&gt;
            }&lt;br /&gt;
          }&lt;br /&gt;
        }&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
    make_github_api_request(data)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def get_pull_request_details(hyperlink_data)&lt;br /&gt;
    response_data = make_github_api_request(get_query(true, hyperlink_data))&lt;br /&gt;
&lt;br /&gt;
    @has_next_page = response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;hasNextPage&amp;quot;]&lt;br /&gt;
    @end_cursor = response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;endCursor&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
    while @has_next_page&lt;br /&gt;
      new_response_data = make_github_api_request(get_query(false, hyperlink_data))&lt;br /&gt;
      response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;edges&amp;quot;].push(*new_response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;edges&amp;quot;])&lt;br /&gt;
      @has_next_page = new_response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;hasNextPage&amp;quot;]&lt;br /&gt;
      @end_cursor = new_response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;endCursor&amp;quot;]&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    response_data&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def process_github_authors_and_dates(author_name, commit_date)&lt;br /&gt;
    @authors[author_name] ||= 1&lt;br /&gt;
    @dates[commit_date] ||= 1&lt;br /&gt;
    @parsed_data[author_name] ||= {}&lt;br /&gt;
    @parsed_data[author_name][commit_date] = if @parsed_data[author_name][commit_date]&lt;br /&gt;
                                               @parsed_data[author_name][commit_date] + 1&lt;br /&gt;
                                             else&lt;br /&gt;
                                               1&lt;br /&gt;
                                             end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def parse_github_data_pull(github_data)&lt;br /&gt;
    team_statistics(github_data)&lt;br /&gt;
    pull_request_object = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;]&lt;br /&gt;
    commit_objects = pull_request_object[&amp;quot;commits&amp;quot;][&amp;quot;edges&amp;quot;]&lt;br /&gt;
    commit_objects.each do |commit_object|&lt;br /&gt;
      commit = commit_object[&amp;quot;node&amp;quot;][&amp;quot;commit&amp;quot;]&lt;br /&gt;
      author_name = commit[&amp;quot;author&amp;quot;][&amp;quot;name&amp;quot;]&lt;br /&gt;
      commit_date = commit[&amp;quot;committedDate&amp;quot;].to_s&lt;br /&gt;
      process_github_authors_and_dates(author_name, commit_date[0, 10])&lt;br /&gt;
    end&lt;br /&gt;
    organize_commit_dates&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def parse_github_data_repo(github_data)&lt;br /&gt;
    commit_history = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;ref&amp;quot;][&amp;quot;target&amp;quot;][&amp;quot;history&amp;quot;]&lt;br /&gt;
    commit_objects = commit_history[&amp;quot;edges&amp;quot;]&lt;br /&gt;
    commit_objects.each do |commit_object|&lt;br /&gt;
      commit_author = commit_object[&amp;quot;node&amp;quot;][&amp;quot;author&amp;quot;]&lt;br /&gt;
      author_name = commit_author[&amp;quot;name&amp;quot;]&lt;br /&gt;
      commit_date = commit_author[&amp;quot;date&amp;quot;].to_s&lt;br /&gt;
      process_github_authors_and_dates(author_name, commit_date[0, 10])&lt;br /&gt;
    end&lt;br /&gt;
    organize_commit_dates&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def make_github_api_request(data)&lt;br /&gt;
    uri = URI.parse(&amp;quot;https://api.github.com/graphql&amp;quot;)&lt;br /&gt;
    http = Net::HTTP.new(uri.host, uri.port)&lt;br /&gt;
    http.use_ssl = true&lt;br /&gt;
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER&lt;br /&gt;
    request = Net::HTTP::Post.new(uri.path, 'Authorization' =&amp;gt; 'Bearer' + ' ' + session[&amp;quot;github_access_token&amp;quot;])&lt;br /&gt;
    request.body = data.to_json&lt;br /&gt;
    http.request(request)&lt;br /&gt;
    response = http.request(request)&lt;br /&gt;
    ActiveSupport::JSON.decode(response.body.to_s)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def organize_commit_dates&lt;br /&gt;
    @dates.each_key do |date|&lt;br /&gt;
      @parsed_data.each_value do |commits|&lt;br /&gt;
        commits[date] ||= 0&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    @parsed_data.each {|author, commits| @parsed_data[author] = Hash[commits.sort_by {|date, _commit_count| date }] }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def team_statistics(github_data)&lt;br /&gt;
    @total_additions += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;additions&amp;quot;]&lt;br /&gt;
    @total_deletions += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;deletions&amp;quot;]&lt;br /&gt;
    @total_files_changed += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;changedFiles&amp;quot;]&lt;br /&gt;
    @total_commits += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;totalCount&amp;quot;]&lt;br /&gt;
    pull_request_number = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;number&amp;quot;]&lt;br /&gt;
    @head_refs[pull_request_number] = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;headRefOid&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
    @merge_status[pull_request_number] = if github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;merged&amp;quot;]&lt;br /&gt;
                                           &amp;quot;MERGED&amp;quot;&lt;br /&gt;
                                         else&lt;br /&gt;
                                           github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;mergeable&amp;quot;]&lt;br /&gt;
                                         end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def get_query(is_initial_page, hyperlink_data)&lt;br /&gt;
    commit_query_line = if is_initial_page&lt;br /&gt;
                          &amp;quot;commits(first:100){&amp;quot;&lt;br /&gt;
                        else&lt;br /&gt;
                          &amp;quot;commits(first:100, after:&amp;quot; + @end_cursor + &amp;quot;){&amp;quot;&lt;br /&gt;
                        end&lt;br /&gt;
    {&lt;br /&gt;
      query: &amp;quot;query {&lt;br /&gt;
        repository(owner: \&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;owner_name&amp;quot;] + &amp;quot;\&amp;quot;, name:\&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;repository_name&amp;quot;] + &amp;quot;\&amp;quot;) {&lt;br /&gt;
          pullRequest(number: &amp;quot; + hyperlink_data[&amp;quot;pull_request_number&amp;quot;] + &amp;quot;) {&lt;br /&gt;
            number additions deletions changedFiles mergeable merged headRefOid&lt;br /&gt;
              &amp;quot; + commit_query_line + &amp;quot;&lt;br /&gt;
                totalCount&lt;br /&gt;
                  pageInfo{&lt;br /&gt;
                    hasNextPage startCursor endCursor&lt;br /&gt;
                    }&lt;br /&gt;
                      edges{&lt;br /&gt;
                        node{&lt;br /&gt;
                          id  commit{&lt;br /&gt;
                                author{&lt;br /&gt;
                                  name&lt;br /&gt;
                                }&lt;br /&gt;
                               additions deletions changedFiles committedDate&lt;br /&gt;
                        }}}}}}}&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Change 1: GitHub metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate Reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data per team member based on different GitHub metrics (e.g.  lines of code added/changed/removed etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Change 2: Bar chart for # of commits changed by the overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Click on the &amp;quot;Github metrics&amp;quot; link for the team whose metrics you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A new page opens and shows # of commits changed per team member since the start of the assignment, also bottom of the page shows summary from Github submissions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Tests'''===&lt;br /&gt;
&lt;br /&gt;
* Following feature tests were added to the Grades_Controller_Spec.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
  describe '#get_statuses_for_pull_request' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(Net::HTTP).to receive(:get) {&amp;quot;{\&amp;quot;team\&amp;quot;:\&amp;quot;rails\&amp;quot;,\&amp;quot;players\&amp;quot;:\&amp;quot;36\&amp;quot;}&amp;quot;}&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'makes a call to the GitHub API to get status of the head commit passed' do&lt;br /&gt;
      expect(controller.get_statuses_for_pull_request('qwerty123')).to eq({&amp;quot;team&amp;quot; =&amp;gt; &amp;quot;rails&amp;quot;, &amp;quot;players&amp;quot; =&amp;gt; &amp;quot;36&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#retrieve_pull_request_data' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(controller).to receive(:get_pull_request_details).and_return({&amp;quot;pr&amp;quot; =&amp;gt; &amp;quot;details&amp;quot;})&lt;br /&gt;
      allow(controller).to receive(:parse_github_data_pull)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'gets pull request details for each PR link submitted' do&lt;br /&gt;
      expect(controller).to receive(:get_pull_request_details).with(&lt;br /&gt;
          {&lt;br /&gt;
              &amp;quot;pull_request_number&amp;quot; =&amp;gt; &amp;quot;1261&amp;quot;,&lt;br /&gt;
              &amp;quot;repository_name&amp;quot; =&amp;gt; &amp;quot;expertiza&amp;quot;,&lt;br /&gt;
              &amp;quot;owner_name&amp;quot; =&amp;gt; &amp;quot;expertiza&amp;quot;&lt;br /&gt;
          })&lt;br /&gt;
      expect(controller).to receive(:get_pull_request_details).with(&lt;br /&gt;
          {&lt;br /&gt;
              &amp;quot;pull_request_number&amp;quot; =&amp;gt; &amp;quot;1293&amp;quot;,&lt;br /&gt;
              &amp;quot;repository_name&amp;quot; =&amp;gt; &amp;quot;mamaMiya&amp;quot;,&lt;br /&gt;
              &amp;quot;owner_name&amp;quot; =&amp;gt; &amp;quot;Shantanu&amp;quot;&lt;br /&gt;
          })&lt;br /&gt;
      controller.retrieve_pull_request_data([&amp;quot;https://github.com/expertiza/expertiza/pull/1261&amp;quot;, &amp;quot;https://github.com/Shantanu/mamaMiya/pull/1293&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'calls parse_github_data_pull on each of the PR details' do&lt;br /&gt;
      expect(controller).to receive(:parse_github_data_pull).with({&amp;quot;pr&amp;quot; =&amp;gt; &amp;quot;details&amp;quot;}).twice&lt;br /&gt;
      controller.retrieve_pull_request_data([&amp;quot;https://github.com/expertiza/expertiza/pull/1261&amp;quot;, &amp;quot;https://github.com/Shantanu/mamaMiya/pull/1293&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#retrieve_repository_data' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(controller).to receive(:get_github_data_repo).and_return({&amp;quot;pr&amp;quot; =&amp;gt; &amp;quot;details&amp;quot;})&lt;br /&gt;
      allow(controller).to receive(:parse_github_data_repo)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'gets details for each repo link submitted, excluding those for expertiza and servo' do&lt;br /&gt;
      expect(controller).to receive(:get_github_data_repo).with(&lt;br /&gt;
          {&lt;br /&gt;
              &amp;quot;repository_name&amp;quot; =&amp;gt; &amp;quot;website&amp;quot;,&lt;br /&gt;
              &amp;quot;owner_name&amp;quot; =&amp;gt; &amp;quot;Shantanu&amp;quot;&lt;br /&gt;
          })&lt;br /&gt;
      expect(controller).to receive(:get_github_data_repo).with(&lt;br /&gt;
          {&lt;br /&gt;
              &amp;quot;repository_name&amp;quot; =&amp;gt; &amp;quot;OODD&amp;quot;,&lt;br /&gt;
              &amp;quot;owner_name&amp;quot; =&amp;gt; &amp;quot;Edward&amp;quot;&lt;br /&gt;
          })&lt;br /&gt;
      controller.retrieve_repository_data([&amp;quot;https://github.com/Shantanu/website&amp;quot;, &amp;quot;https://github.com/Edward/OODD&amp;quot;, &amp;quot;https://github.com/expertiza/expertiza&amp;quot;, &amp;quot;https://github.com/Shantanu/expertiza]&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'calls parse_github_data_repo on each of the PR details' do&lt;br /&gt;
      expect(controller).to receive(:parse_github_data_repo).with({&amp;quot;pr&amp;quot; =&amp;gt; &amp;quot;details&amp;quot;}).twice&lt;br /&gt;
      controller.retrieve_repository_data([&amp;quot;https://github.com/Shantanu/website&amp;quot;, &amp;quot;https://github.com/Edward/OODD&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#retrieve_github_data' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(controller).to receive(:retrieve_pull_request_data)&lt;br /&gt;
      allow(controller).to receive(:retrieve_repository_data)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when pull request links have been submitted' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        teams_mock = double&lt;br /&gt;
        allow(teams_mock).to receive(:hyperlinks).and_return([&amp;quot;https://github.com/Shantanu/website&amp;quot;, &amp;quot;https://github.com/Shantanu/website/pull/1123&amp;quot;])&lt;br /&gt;
        controller.instance_variable_set(:@team, teams_mock)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'retrieves PR data only' do&lt;br /&gt;
        expect(controller).to receive(:retrieve_pull_request_data).with([&amp;quot;https://github.com/Shantanu/website/pull/1123&amp;quot;])&lt;br /&gt;
        controller.retrieve_github_data&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when pull request links have not been submitted' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        teams_mock = double&lt;br /&gt;
        allow(teams_mock).to receive(:hyperlinks).and_return([&amp;quot;https://github.com/Shantanu/website&amp;quot;, &amp;quot;https://github.com/expertiza/expertiza&amp;quot;])&lt;br /&gt;
        controller.instance_variable_set(:@team, teams_mock)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'retrieves repo details ' do&lt;br /&gt;
        expect(controller).to receive(:retrieve_repository_data).with([&amp;quot;https://github.com/Shantanu/website&amp;quot;, &amp;quot;https://github.com/expertiza/expertiza&amp;quot;])&lt;br /&gt;
        controller.retrieve_github_data&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#retrieve_check_run_statuses' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(controller).to receive(:get_statuses_for_pull_request).and_return(&amp;quot;check_status&amp;quot;)&lt;br /&gt;
      controller.instance_variable_set(:@headRefs, {&amp;quot;1234&amp;quot; =&amp;gt; &amp;quot;qwerty&amp;quot;, &amp;quot;5678&amp;quot; =&amp;gt; &amp;quot;asdfg&amp;quot;})&lt;br /&gt;
      controller.instance_variable_set(:@check_statuses, {})&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'gets and stores the statuses associated with head commits of PRs' do&lt;br /&gt;
      expect(controller).to receive(:get_statuses_for_pull_request).with(&amp;quot;qwerty&amp;quot;)&lt;br /&gt;
      expect(controller).to receive(:get_statuses_for_pull_request).with(&amp;quot;asdfg&amp;quot;)&lt;br /&gt;
      controller.retrieve_check_run_statuses&lt;br /&gt;
      expect(controller.instance_variable_get(:@check_statuses)).to eq({&amp;quot;1234&amp;quot; =&amp;gt; &amp;quot;check_status&amp;quot;, &amp;quot;5678&amp;quot; =&amp;gt; &amp;quot;check_status&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view_github_metrics' do&lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'stores the current participant id and the view action' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(session[&amp;quot;participant_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_submissions&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when user has logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = &amp;quot;qwerty&amp;quot;&lt;br /&gt;
        allow(controller).to receive(:get_statuses_for_pull_request).and_return(&amp;quot;status&amp;quot;)&lt;br /&gt;
        allow(controller).to receive(:retrieve_github_data)&lt;br /&gt;
        allow(controller).to receive(:retrieve_check_run_statuses)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'stores the GitHub access token for later use' do&lt;br /&gt;
        get :view_github_metrics, {id: '1'}&lt;br /&gt;
        expect(controller.instance_variable_get(:@token)).to eq(&amp;quot;qwerty&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'calls retrieve_github_data to retrieve data from GitHub' do&lt;br /&gt;
        expect(controller).to receive(:retrieve_github_data)&lt;br /&gt;
        get :view_github_metrics, {id: '1'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      it 'calls retrieve_check_run_statuses to retrieve check runs data' do&lt;br /&gt;
        expect(controller).to receive(:retrieve_check_run_statuses)&lt;br /&gt;
        get :view_github_metrics, {id: '1'}&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Change-log for Reviewers'''==&lt;br /&gt;
This section will be removed in the final draft. It is just here for convenience of reviewers to know which sections were majorly updated from last review.&lt;br /&gt;
&lt;br /&gt;
* '''Added''' Solution Design for the final implemented design&lt;br /&gt;
* '''Added''' Implemented Solution to show feature additions to Expertiza&lt;br /&gt;
* '''Added''' Feature test cases for Grades controller&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ GitHub API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121433</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121433"/>
		<updated>2018-12-08T23:59:06Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Code Change in Grades_Controller */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''Teammate Reviews''' under '''View Scores''' functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give a more realistic view of the work contribution of every team member using external tools like GitHub.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from GitHub. &lt;br /&gt;
&lt;br /&gt;
:1. '''Teammate Reviews''' functionality in the View Scores page gauges teammate views on how much other team members contributed to the project. We need to augment this data with data from external tools like GitHub in order to validate that feedback. New metrics will be appended under each student data under the same functionality.&lt;br /&gt;
:2. '''Github Metrics''' under '''View Submissions''' page should include a bar chart that shows number of commits by the team throughout the assignment timeline. This will help instructors to get a team overview, and aid grading process.&lt;br /&gt;
&lt;br /&gt;
While this data will not have marks associated directly, it will prove useful to the instructor in differentiating the performance of team members and hence awarding marks as per contribution. Overall data for the team, like the number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
Previously, view submission does not show work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows peer review amongst teammates. Currently, however, there is no way to validate and verify these reviews.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on GitHub is a solution, but that is inefficient from instructor's/reviewer's perspective as there are many assignments, submissions, and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
==='''Use Case Diagram'''===&lt;br /&gt;
[[File:UC_1.png|none|frame|1. Use Case diagram of two approaches to append 'GitHub contribution metric' in teammate review. 2. Use Case diagram explaining approach to add new column 'GitHub contribution metric' in 'View submission]]&lt;br /&gt;
&lt;br /&gt;
===='''Use Case Diagram Details'''====&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing, and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able to see the team contribution done by each team member in 'View Submissions' page using graph diagrams, as shown in the figure.&lt;br /&gt;
*Instructor will be able to see the work done by each student in 'Teammate Review Tab' with new metrics table appended at the end, as shown in the figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing our end-point for pulling GitHub data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Solution Design'''==&lt;br /&gt;
&lt;br /&gt;
* The Github metrics that need to be integrated with Expertiza were finalized as below. These metrics are captured on a per-user basis:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# Pull Request Status ( includes code climate and Travis CI Build status)&lt;br /&gt;
*#User Github metrics:&lt;br /&gt;
*## Committer ID&lt;br /&gt;
*## Committer Name&lt;br /&gt;
*## Committer email ID&lt;br /&gt;
	&lt;br /&gt;
* A new link &amp;quot;Github Metrics&amp;quot; is provided under “View Submissions” for an assignment in the instructor view.This link opens a new tab and shows a stacked bar chart for number of commits per user vs submission timeline from assignment creation date to the deadline.&lt;br /&gt;
* In &amp;quot;View Scores&amp;quot; for an assignment in the instructor view, under Teammate Reviews tab, a new table for Github Metrics is added, which shows following Github metrics per user:&lt;br /&gt;
:Student Name/ID, Email ID, lines of code added, lines of code deleted, number of commits&lt;br /&gt;
&lt;br /&gt;
* For GitHub integration, we have used GitHub GraphQL API v4. We have used OAuth gem for authentication purpose.&lt;br /&gt;
&lt;br /&gt;
* We parse the link to PR to get data associated with it. We have also handled projects which do not have PR link, but just a link to the repository.&lt;br /&gt;
&lt;br /&gt;
=='''Implemented Solution'''==&lt;br /&gt;
&lt;br /&gt;
==='''Files Modified'''===&lt;br /&gt;
&lt;br /&gt;
* app/controllers/auth_controller.rb&lt;br /&gt;
* app/controllers/grades_controller.rb&lt;br /&gt;
* app/helpers/grades_helper.rb&lt;br /&gt;
* app/views/assignments/list_submissions.html.erb&lt;br /&gt;
* app/views/grades/_tabbing.html.erb&lt;br /&gt;
* app/views/grades/_teammate_reviews_tab.html.erb&lt;br /&gt;
* app/views/grades/view.html.erb&lt;br /&gt;
* app/views/grades/view_team.html.erb&lt;br /&gt;
* config/application.rb&lt;br /&gt;
* config/initializers/load_config.rb&lt;br /&gt;
* config/initializers/omniauth.rb&lt;br /&gt;
* config/routes.rb&lt;br /&gt;
&lt;br /&gt;
==='''Files Added'''===&lt;br /&gt;
&lt;br /&gt;
* app/views/grades/view_github_metrics.html.erb&lt;br /&gt;
* config/github_auth.yml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''First Change'''===&lt;br /&gt;
&lt;br /&gt;
* A new table &amp;quot;Github Metrics&amp;quot; is added under Manage-&amp;gt; Assignments -&amp;gt; View Scores -&amp;gt; Teammate Reviews. Below is the screenshot of the implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter4.png|none|frame|The GitHub metrics table shows results for each team member]]&lt;br /&gt;
&lt;br /&gt;
==='''Second Change'''===&lt;br /&gt;
* The second change is in the View Submissions page, where we have added a link &amp;quot;Github Metrics&amp;quot; to a new page.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter3.png|none|frame|&lt;br /&gt;
At present, view submission shows group assignments are submitted as a single submission and 'view github metric' link shows work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
* The new page appears after clicking on the link &amp;quot;Github metrics&amp;quot;, that shows bar chart for # of commits per day. We have also added other relevant information about Pull Request, such as total commits, lines of code added, lines of code modified, PR merge status, check status.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_3.png|none|frame|The bar chart]]&lt;br /&gt;
[[File:Ooddafter10.png|none|frame|The Github summary]]&lt;br /&gt;
&lt;br /&gt;
===='''Code Change in Grades_Controller'''====&lt;br /&gt;
Added below new functions to implement Github Integration in View Submission page&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def get_statuses_for_pull_request(ref)&lt;br /&gt;
    url = &amp;quot;https://api.github.com/repos/expertiza/expertiza/commits/&amp;quot; + ref + &amp;quot;/status&amp;quot;&lt;br /&gt;
    ActiveSupport::JSON.decode(Net::HTTP.get(URI(url)))&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_pull_request_data(pull_links)&lt;br /&gt;
    pull_links.each do |hyperlink|&lt;br /&gt;
      submission_hyperlink_tokens = hyperlink.split('/')&lt;br /&gt;
      hyperlink_data = {}&lt;br /&gt;
      hyperlink_data[&amp;quot;pull_request_number&amp;quot;] = submission_hyperlink_tokens.pop&lt;br /&gt;
      submission_hyperlink_tokens.pop&lt;br /&gt;
      hyperlink_data[&amp;quot;repository_name&amp;quot;] = submission_hyperlink_tokens.pop&lt;br /&gt;
      hyperlink_data[&amp;quot;owner_name&amp;quot;] = submission_hyperlink_tokens.pop&lt;br /&gt;
      github_data = get_pull_request_details(hyperlink_data)&lt;br /&gt;
      parse_github_data_pull(github_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_repository_data(repo_links)&lt;br /&gt;
    repo_links.each do |hyperlink|&lt;br /&gt;
      submission_hyperlink_tokens = hyperlink.split('/')&lt;br /&gt;
      hyperlink_data = {}&lt;br /&gt;
      hyperlink_data[&amp;quot;repository_name&amp;quot;] = submission_hyperlink_tokens[4]&lt;br /&gt;
      next if hyperlink_data[&amp;quot;repository_name&amp;quot;] == &amp;quot;servo&amp;quot; || hyperlink_data[&amp;quot;repository_name&amp;quot;] == &amp;quot;expertiza&amp;quot;&lt;br /&gt;
      hyperlink_data[&amp;quot;owner_name&amp;quot;] = submission_hyperlink_tokens[3]&lt;br /&gt;
      github_data = get_github_data_repo(hyperlink_data)&lt;br /&gt;
      parse_github_data_repo(github_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_github_data&lt;br /&gt;
    team_links = @team.hyperlinks&lt;br /&gt;
    pull_links = team_links.select do |link|&lt;br /&gt;
      link.match(/pull/) &amp;amp;&amp;amp; link.match(/github.com/)&lt;br /&gt;
    end&lt;br /&gt;
    if !pull_links.empty?&lt;br /&gt;
      retrieve_pull_request_data(pull_links)&lt;br /&gt;
    else&lt;br /&gt;
      repo_links = team_links.select do |link|&lt;br /&gt;
        link.match(/github.com/)&lt;br /&gt;
      end&lt;br /&gt;
      retrieve_repository_data(repo_links)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_check_run_statuses&lt;br /&gt;
    @head_refs.each do |pull_number, ref|&lt;br /&gt;
      @check_statuses[pull_number] = get_statuses_for_pull_request(ref)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def view_github_metrics&lt;br /&gt;
    if session[&amp;quot;github_access_token&amp;quot;].nil?&lt;br /&gt;
      session[&amp;quot;participant_id&amp;quot;] = params[:id]&lt;br /&gt;
      session[&amp;quot;github_view_type&amp;quot;] = &amp;quot;view_submissions&amp;quot;&lt;br /&gt;
      redirect_to authorize_github_grades_path&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @head_refs = {}&lt;br /&gt;
    @parsed_data = {}&lt;br /&gt;
    @authors = {}&lt;br /&gt;
    @dates = {}&lt;br /&gt;
    @total_additions = 0&lt;br /&gt;
    @total_deletions = 0&lt;br /&gt;
    @total_commits = 0&lt;br /&gt;
    @total_files_changed = 0&lt;br /&gt;
    @merge_status = {}&lt;br /&gt;
    @check_statuses = {}&lt;br /&gt;
&lt;br /&gt;
    @token = session[&amp;quot;github_access_token&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    @team_id = @team.id&lt;br /&gt;
&lt;br /&gt;
    retrieve_github_data&lt;br /&gt;
    retrieve_check_run_statuses&lt;br /&gt;
&lt;br /&gt;
    @authors = @authors.keys&lt;br /&gt;
    @dates = @dates.keys.sort&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def authorize_github&lt;br /&gt;
    redirect_to &amp;quot;https://github.com/login/oauth/authorize?client_id=#{GITHUB_CONFIG['client_key']}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def get_github_data_repo(hyperlink_data)&lt;br /&gt;
    data = {&lt;br /&gt;
      query: &amp;quot;query {&lt;br /&gt;
        repository(owner: \&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;owner_name&amp;quot;] + &amp;quot;\&amp;quot;, name: \&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;repository_name&amp;quot;] + &amp;quot;\&amp;quot;) {&lt;br /&gt;
          ref(qualifiedName: \&amp;quot;master\&amp;quot;) {&lt;br /&gt;
            target {&lt;br /&gt;
              ... on Commit {&lt;br /&gt;
                id&lt;br /&gt;
                  history(first: 100) {&lt;br /&gt;
                    edges {&lt;br /&gt;
                      node {&lt;br /&gt;
                        id author {&lt;br /&gt;
                          name email date&lt;br /&gt;
                        }&lt;br /&gt;
                      }&lt;br /&gt;
                    }&lt;br /&gt;
                  }&lt;br /&gt;
                }&lt;br /&gt;
              }&lt;br /&gt;
            }&lt;br /&gt;
          }&lt;br /&gt;
        }&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
    make_github_api_request(data)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def get_pull_request_details(hyperlink_data)&lt;br /&gt;
    response_data = make_github_api_request(get_query(true, hyperlink_data))&lt;br /&gt;
&lt;br /&gt;
    @has_next_page = response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;hasNextPage&amp;quot;]&lt;br /&gt;
    @end_cursor = response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;endCursor&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
    while @has_next_page&lt;br /&gt;
      new_response_data = make_github_api_request(get_query(false, hyperlink_data))&lt;br /&gt;
      response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;edges&amp;quot;].push(*new_response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;edges&amp;quot;])&lt;br /&gt;
      @has_next_page = new_response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;hasNextPage&amp;quot;]&lt;br /&gt;
      @end_cursor = new_response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;endCursor&amp;quot;]&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    response_data&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def process_github_authors_and_dates(author_name, commit_date)&lt;br /&gt;
    @authors[author_name] ||= 1&lt;br /&gt;
    @dates[commit_date] ||= 1&lt;br /&gt;
    @parsed_data[author_name] ||= {}&lt;br /&gt;
    @parsed_data[author_name][commit_date] = if @parsed_data[author_name][commit_date]&lt;br /&gt;
                                               @parsed_data[author_name][commit_date] + 1&lt;br /&gt;
                                             else&lt;br /&gt;
                                               1&lt;br /&gt;
                                             end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def parse_github_data_pull(github_data)&lt;br /&gt;
    team_statistics(github_data)&lt;br /&gt;
    pull_request_object = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;]&lt;br /&gt;
    commit_objects = pull_request_object[&amp;quot;commits&amp;quot;][&amp;quot;edges&amp;quot;]&lt;br /&gt;
    commit_objects.each do |commit_object|&lt;br /&gt;
      commit = commit_object[&amp;quot;node&amp;quot;][&amp;quot;commit&amp;quot;]&lt;br /&gt;
      author_name = commit[&amp;quot;author&amp;quot;][&amp;quot;name&amp;quot;]&lt;br /&gt;
      commit_date = commit[&amp;quot;committedDate&amp;quot;].to_s&lt;br /&gt;
      process_github_authors_and_dates(author_name, commit_date[0, 10])&lt;br /&gt;
    end&lt;br /&gt;
    organize_commit_dates&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def parse_github_data_repo(github_data)&lt;br /&gt;
    commit_history = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;ref&amp;quot;][&amp;quot;target&amp;quot;][&amp;quot;history&amp;quot;]&lt;br /&gt;
    commit_objects = commit_history[&amp;quot;edges&amp;quot;]&lt;br /&gt;
    commit_objects.each do |commit_object|&lt;br /&gt;
      commit_author = commit_object[&amp;quot;node&amp;quot;][&amp;quot;author&amp;quot;]&lt;br /&gt;
      author_name = commit_author[&amp;quot;name&amp;quot;]&lt;br /&gt;
      commit_date = commit_author[&amp;quot;date&amp;quot;].to_s&lt;br /&gt;
      process_github_authors_and_dates(author_name, commit_date[0, 10])&lt;br /&gt;
    end&lt;br /&gt;
    organize_commit_dates&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def make_github_api_request(data)&lt;br /&gt;
    uri = URI.parse(&amp;quot;https://api.github.com/graphql&amp;quot;)&lt;br /&gt;
    http = Net::HTTP.new(uri.host, uri.port)&lt;br /&gt;
    http.use_ssl = true&lt;br /&gt;
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER&lt;br /&gt;
    request = Net::HTTP::Post.new(uri.path, 'Authorization' =&amp;gt; 'Bearer' + ' ' + session[&amp;quot;github_access_token&amp;quot;])&lt;br /&gt;
    request.body = data.to_json&lt;br /&gt;
    http.request(request)&lt;br /&gt;
    response = http.request(request)&lt;br /&gt;
    ActiveSupport::JSON.decode(response.body.to_s)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def organize_commit_dates&lt;br /&gt;
    @dates.each_key do |date|&lt;br /&gt;
      @parsed_data.each_value do |commits|&lt;br /&gt;
        commits[date] ||= 0&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    @parsed_data.each {|author, commits| @parsed_data[author] = Hash[commits.sort_by {|date, _commit_count| date }] }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def team_statistics(github_data)&lt;br /&gt;
    @total_additions += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;additions&amp;quot;]&lt;br /&gt;
    @total_deletions += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;deletions&amp;quot;]&lt;br /&gt;
    @total_files_changed += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;changedFiles&amp;quot;]&lt;br /&gt;
    @total_commits += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;totalCount&amp;quot;]&lt;br /&gt;
    pull_request_number = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;number&amp;quot;]&lt;br /&gt;
    @head_refs[pull_request_number] = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;headRefOid&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
    @merge_status[pull_request_number] = if github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;merged&amp;quot;]&lt;br /&gt;
                                           &amp;quot;MERGED&amp;quot;&lt;br /&gt;
                                         else&lt;br /&gt;
                                           github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;mergeable&amp;quot;]&lt;br /&gt;
                                         end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def get_query(is_initial_page, hyperlink_data)&lt;br /&gt;
    commit_query_line = if is_initial_page&lt;br /&gt;
                          &amp;quot;commits(first:100){&amp;quot;&lt;br /&gt;
                        else&lt;br /&gt;
                          &amp;quot;commits(first:100, after:&amp;quot; + @end_cursor + &amp;quot;){&amp;quot;&lt;br /&gt;
                        end&lt;br /&gt;
    {&lt;br /&gt;
      query: &amp;quot;query {&lt;br /&gt;
        repository(owner: \&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;owner_name&amp;quot;] + &amp;quot;\&amp;quot;, name:\&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;repository_name&amp;quot;] + &amp;quot;\&amp;quot;) {&lt;br /&gt;
          pullRequest(number: &amp;quot; + hyperlink_data[&amp;quot;pull_request_number&amp;quot;] + &amp;quot;) {&lt;br /&gt;
            number additions deletions changedFiles mergeable merged headRefOid&lt;br /&gt;
              &amp;quot; + commit_query_line + &amp;quot;&lt;br /&gt;
                totalCount&lt;br /&gt;
                  pageInfo{&lt;br /&gt;
                    hasNextPage startCursor endCursor&lt;br /&gt;
                    }&lt;br /&gt;
                      edges{&lt;br /&gt;
                        node{&lt;br /&gt;
                          id  commit{&lt;br /&gt;
                                author{&lt;br /&gt;
                                  name&lt;br /&gt;
                                }&lt;br /&gt;
                               additions deletions changedFiles committedDate&lt;br /&gt;
                        }}}}}}}&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Change 1: GitHub metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate Reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data per team member based on different GitHub metrics (e.g.  lines of code added/changed/removed etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Change 2: Bar chart for # of commits changed by the overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Click on the &amp;quot;Github metrics&amp;quot; link for the team whose metrics you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A new page opens and shows # of commits changed per team member since the start of the assignment, also bottom of the page shows summary from Github submissions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Tests'''===&lt;br /&gt;
&lt;br /&gt;
* Following feature tests were added to the Grades_Controller_Spec.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#get_statuses_for_pull_request&amp;quot; do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(Net::HTTP).to receive(:get) {&amp;quot;{\&amp;quot;team\&amp;quot;:\&amp;quot;rails\&amp;quot;,\&amp;quot;players\&amp;quot;:\&amp;quot;36\&amp;quot;}&amp;quot;}&lt;br /&gt;
    end&lt;br /&gt;
     it 'makes a call to the GitHub API to get status of the head commit passed' do&lt;br /&gt;
      expect(controller.get_statuses_for_pull_request('qwerty123')).to eq({&amp;quot;team&amp;quot; =&amp;gt; &amp;quot;rails&amp;quot;, &amp;quot;players&amp;quot; =&amp;gt; &amp;quot;36&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe '#view_github_metrics' do&lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current participant id and the view action' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(session[&amp;quot;participant_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_submissions&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view' do  &lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current assignment id and the view action' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(session[&amp;quot;assignment_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_scores&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Change-log for Reviewers'''==&lt;br /&gt;
This section will be removed in the final draft. It is just here for convenience of reviewers to know which sections were majorly updated from last review.&lt;br /&gt;
&lt;br /&gt;
* '''Added''' Solution Design for the final implemented design&lt;br /&gt;
* '''Added''' Implemented Solution to show feature additions to Expertiza&lt;br /&gt;
* '''Added''' Feature test cases for Grades controller&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ GitHub API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121432</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121432"/>
		<updated>2018-12-08T23:58:05Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Implemented Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''Teammate Reviews''' under '''View Scores''' functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give a more realistic view of the work contribution of every team member using external tools like GitHub.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from GitHub. &lt;br /&gt;
&lt;br /&gt;
:1. '''Teammate Reviews''' functionality in the View Scores page gauges teammate views on how much other team members contributed to the project. We need to augment this data with data from external tools like GitHub in order to validate that feedback. New metrics will be appended under each student data under the same functionality.&lt;br /&gt;
:2. '''Github Metrics''' under '''View Submissions''' page should include a bar chart that shows number of commits by the team throughout the assignment timeline. This will help instructors to get a team overview, and aid grading process.&lt;br /&gt;
&lt;br /&gt;
While this data will not have marks associated directly, it will prove useful to the instructor in differentiating the performance of team members and hence awarding marks as per contribution. Overall data for the team, like the number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
Previously, view submission does not show work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows peer review amongst teammates. Currently, however, there is no way to validate and verify these reviews.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on GitHub is a solution, but that is inefficient from instructor's/reviewer's perspective as there are many assignments, submissions, and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
==='''Use Case Diagram'''===&lt;br /&gt;
[[File:UC_1.png|none|frame|1. Use Case diagram of two approaches to append 'GitHub contribution metric' in teammate review. 2. Use Case diagram explaining approach to add new column 'GitHub contribution metric' in 'View submission]]&lt;br /&gt;
&lt;br /&gt;
===='''Use Case Diagram Details'''====&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing, and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able to see the team contribution done by each team member in 'View Submissions' page using graph diagrams, as shown in the figure.&lt;br /&gt;
*Instructor will be able to see the work done by each student in 'Teammate Review Tab' with new metrics table appended at the end, as shown in the figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing our end-point for pulling GitHub data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Solution Design'''==&lt;br /&gt;
&lt;br /&gt;
* The Github metrics that need to be integrated with Expertiza were finalized as below. These metrics are captured on a per-user basis:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# Pull Request Status ( includes code climate and Travis CI Build status)&lt;br /&gt;
*#User Github metrics:&lt;br /&gt;
*## Committer ID&lt;br /&gt;
*## Committer Name&lt;br /&gt;
*## Committer email ID&lt;br /&gt;
	&lt;br /&gt;
* A new link &amp;quot;Github Metrics&amp;quot; is provided under “View Submissions” for an assignment in the instructor view.This link opens a new tab and shows a stacked bar chart for number of commits per user vs submission timeline from assignment creation date to the deadline.&lt;br /&gt;
* In &amp;quot;View Scores&amp;quot; for an assignment in the instructor view, under Teammate Reviews tab, a new table for Github Metrics is added, which shows following Github metrics per user:&lt;br /&gt;
:Student Name/ID, Email ID, lines of code added, lines of code deleted, number of commits&lt;br /&gt;
&lt;br /&gt;
* For GitHub integration, we have used GitHub GraphQL API v4. We have used OAuth gem for authentication purpose.&lt;br /&gt;
&lt;br /&gt;
* We parse the link to PR to get data associated with it. We have also handled projects which do not have PR link, but just a link to the repository.&lt;br /&gt;
&lt;br /&gt;
=='''Implemented Solution'''==&lt;br /&gt;
&lt;br /&gt;
==='''Files Modified'''===&lt;br /&gt;
&lt;br /&gt;
* app/controllers/auth_controller.rb&lt;br /&gt;
* app/controllers/grades_controller.rb&lt;br /&gt;
* app/helpers/grades_helper.rb&lt;br /&gt;
* app/views/assignments/list_submissions.html.erb&lt;br /&gt;
* app/views/grades/_tabbing.html.erb&lt;br /&gt;
* app/views/grades/_teammate_reviews_tab.html.erb&lt;br /&gt;
* app/views/grades/view.html.erb&lt;br /&gt;
* app/views/grades/view_team.html.erb&lt;br /&gt;
* config/application.rb&lt;br /&gt;
* config/initializers/load_config.rb&lt;br /&gt;
* config/initializers/omniauth.rb&lt;br /&gt;
* config/routes.rb&lt;br /&gt;
&lt;br /&gt;
==='''Files Added'''===&lt;br /&gt;
&lt;br /&gt;
* app/views/grades/view_github_metrics.html.erb&lt;br /&gt;
* config/github_auth.yml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''First Change'''===&lt;br /&gt;
&lt;br /&gt;
* A new table &amp;quot;Github Metrics&amp;quot; is added under Manage-&amp;gt; Assignments -&amp;gt; View Scores -&amp;gt; Teammate Reviews. Below is the screenshot of the implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter4.png|none|frame|The GitHub metrics table shows results for each team member]]&lt;br /&gt;
&lt;br /&gt;
==='''Second Change'''===&lt;br /&gt;
* The second change is in the View Submissions page, where we have added a link &amp;quot;Github Metrics&amp;quot; to a new page.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter3.png|none|frame|&lt;br /&gt;
At present, view submission shows group assignments are submitted as a single submission and 'view github metric' link shows work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
* The new page appears after clicking on the link &amp;quot;Github metrics&amp;quot;, that shows bar chart for # of commits per day. We have also added other relevant information about Pull Request, such as total commits, lines of code added, lines of code modified, PR merge status, check status.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_3.png|none|frame|The bar chart]]&lt;br /&gt;
[[File:Ooddafter10.png|none|frame|The Github summary]]&lt;br /&gt;
&lt;br /&gt;
===='''Code Change in Grades_Controller'''====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def get_statuses_for_pull_request(ref)&lt;br /&gt;
    url = &amp;quot;https://api.github.com/repos/expertiza/expertiza/commits/&amp;quot; + ref + &amp;quot;/status&amp;quot;&lt;br /&gt;
    ActiveSupport::JSON.decode(Net::HTTP.get(URI(url)))&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_pull_request_data(pull_links)&lt;br /&gt;
    pull_links.each do |hyperlink|&lt;br /&gt;
      submission_hyperlink_tokens = hyperlink.split('/')&lt;br /&gt;
      hyperlink_data = {}&lt;br /&gt;
      hyperlink_data[&amp;quot;pull_request_number&amp;quot;] = submission_hyperlink_tokens.pop&lt;br /&gt;
      submission_hyperlink_tokens.pop&lt;br /&gt;
      hyperlink_data[&amp;quot;repository_name&amp;quot;] = submission_hyperlink_tokens.pop&lt;br /&gt;
      hyperlink_data[&amp;quot;owner_name&amp;quot;] = submission_hyperlink_tokens.pop&lt;br /&gt;
      github_data = get_pull_request_details(hyperlink_data)&lt;br /&gt;
      parse_github_data_pull(github_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_repository_data(repo_links)&lt;br /&gt;
    repo_links.each do |hyperlink|&lt;br /&gt;
      submission_hyperlink_tokens = hyperlink.split('/')&lt;br /&gt;
      hyperlink_data = {}&lt;br /&gt;
      hyperlink_data[&amp;quot;repository_name&amp;quot;] = submission_hyperlink_tokens[4]&lt;br /&gt;
      next if hyperlink_data[&amp;quot;repository_name&amp;quot;] == &amp;quot;servo&amp;quot; || hyperlink_data[&amp;quot;repository_name&amp;quot;] == &amp;quot;expertiza&amp;quot;&lt;br /&gt;
      hyperlink_data[&amp;quot;owner_name&amp;quot;] = submission_hyperlink_tokens[3]&lt;br /&gt;
      github_data = get_github_data_repo(hyperlink_data)&lt;br /&gt;
      parse_github_data_repo(github_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_github_data&lt;br /&gt;
    team_links = @team.hyperlinks&lt;br /&gt;
    pull_links = team_links.select do |link|&lt;br /&gt;
      link.match(/pull/) &amp;amp;&amp;amp; link.match(/github.com/)&lt;br /&gt;
    end&lt;br /&gt;
    if !pull_links.empty?&lt;br /&gt;
      retrieve_pull_request_data(pull_links)&lt;br /&gt;
    else&lt;br /&gt;
      repo_links = team_links.select do |link|&lt;br /&gt;
        link.match(/github.com/)&lt;br /&gt;
      end&lt;br /&gt;
      retrieve_repository_data(repo_links)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def retrieve_check_run_statuses&lt;br /&gt;
    @head_refs.each do |pull_number, ref|&lt;br /&gt;
      @check_statuses[pull_number] = get_statuses_for_pull_request(ref)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def view_github_metrics&lt;br /&gt;
    if session[&amp;quot;github_access_token&amp;quot;].nil?&lt;br /&gt;
      session[&amp;quot;participant_id&amp;quot;] = params[:id]&lt;br /&gt;
      session[&amp;quot;github_view_type&amp;quot;] = &amp;quot;view_submissions&amp;quot;&lt;br /&gt;
      redirect_to authorize_github_grades_path&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @head_refs = {}&lt;br /&gt;
    @parsed_data = {}&lt;br /&gt;
    @authors = {}&lt;br /&gt;
    @dates = {}&lt;br /&gt;
    @total_additions = 0&lt;br /&gt;
    @total_deletions = 0&lt;br /&gt;
    @total_commits = 0&lt;br /&gt;
    @total_files_changed = 0&lt;br /&gt;
    @merge_status = {}&lt;br /&gt;
    @check_statuses = {}&lt;br /&gt;
&lt;br /&gt;
    @token = session[&amp;quot;github_access_token&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    @assignment = @participant.assignment&lt;br /&gt;
    @team = @participant.team&lt;br /&gt;
    @team_id = @team.id&lt;br /&gt;
&lt;br /&gt;
    retrieve_github_data&lt;br /&gt;
    retrieve_check_run_statuses&lt;br /&gt;
&lt;br /&gt;
    @authors = @authors.keys&lt;br /&gt;
    @dates = @dates.keys.sort&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def authorize_github&lt;br /&gt;
    redirect_to &amp;quot;https://github.com/login/oauth/authorize?client_id=#{GITHUB_CONFIG['client_key']}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def get_github_data_repo(hyperlink_data)&lt;br /&gt;
    data = {&lt;br /&gt;
      query: &amp;quot;query {&lt;br /&gt;
        repository(owner: \&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;owner_name&amp;quot;] + &amp;quot;\&amp;quot;, name: \&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;repository_name&amp;quot;] + &amp;quot;\&amp;quot;) {&lt;br /&gt;
          ref(qualifiedName: \&amp;quot;master\&amp;quot;) {&lt;br /&gt;
            target {&lt;br /&gt;
              ... on Commit {&lt;br /&gt;
                id&lt;br /&gt;
                  history(first: 100) {&lt;br /&gt;
                    edges {&lt;br /&gt;
                      node {&lt;br /&gt;
                        id author {&lt;br /&gt;
                          name email date&lt;br /&gt;
                        }&lt;br /&gt;
                      }&lt;br /&gt;
                    }&lt;br /&gt;
                  }&lt;br /&gt;
                }&lt;br /&gt;
              }&lt;br /&gt;
            }&lt;br /&gt;
          }&lt;br /&gt;
        }&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
    make_github_api_request(data)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def get_pull_request_details(hyperlink_data)&lt;br /&gt;
    response_data = make_github_api_request(get_query(true, hyperlink_data))&lt;br /&gt;
&lt;br /&gt;
    @has_next_page = response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;hasNextPage&amp;quot;]&lt;br /&gt;
    @end_cursor = response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;endCursor&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
    while @has_next_page&lt;br /&gt;
      new_response_data = make_github_api_request(get_query(false, hyperlink_data))&lt;br /&gt;
      response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;edges&amp;quot;].push(*new_response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;edges&amp;quot;])&lt;br /&gt;
      @has_next_page = new_response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;hasNextPage&amp;quot;]&lt;br /&gt;
      @end_cursor = new_response_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;pageInfo&amp;quot;][&amp;quot;endCursor&amp;quot;]&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    response_data&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def process_github_authors_and_dates(author_name, commit_date)&lt;br /&gt;
    @authors[author_name] ||= 1&lt;br /&gt;
    @dates[commit_date] ||= 1&lt;br /&gt;
    @parsed_data[author_name] ||= {}&lt;br /&gt;
    @parsed_data[author_name][commit_date] = if @parsed_data[author_name][commit_date]&lt;br /&gt;
                                               @parsed_data[author_name][commit_date] + 1&lt;br /&gt;
                                             else&lt;br /&gt;
                                               1&lt;br /&gt;
                                             end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def parse_github_data_pull(github_data)&lt;br /&gt;
    team_statistics(github_data)&lt;br /&gt;
    pull_request_object = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;]&lt;br /&gt;
    commit_objects = pull_request_object[&amp;quot;commits&amp;quot;][&amp;quot;edges&amp;quot;]&lt;br /&gt;
    commit_objects.each do |commit_object|&lt;br /&gt;
      commit = commit_object[&amp;quot;node&amp;quot;][&amp;quot;commit&amp;quot;]&lt;br /&gt;
      author_name = commit[&amp;quot;author&amp;quot;][&amp;quot;name&amp;quot;]&lt;br /&gt;
      commit_date = commit[&amp;quot;committedDate&amp;quot;].to_s&lt;br /&gt;
      process_github_authors_and_dates(author_name, commit_date[0, 10])&lt;br /&gt;
    end&lt;br /&gt;
    organize_commit_dates&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def parse_github_data_repo(github_data)&lt;br /&gt;
    commit_history = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;ref&amp;quot;][&amp;quot;target&amp;quot;][&amp;quot;history&amp;quot;]&lt;br /&gt;
    commit_objects = commit_history[&amp;quot;edges&amp;quot;]&lt;br /&gt;
    commit_objects.each do |commit_object|&lt;br /&gt;
      commit_author = commit_object[&amp;quot;node&amp;quot;][&amp;quot;author&amp;quot;]&lt;br /&gt;
      author_name = commit_author[&amp;quot;name&amp;quot;]&lt;br /&gt;
      commit_date = commit_author[&amp;quot;date&amp;quot;].to_s&lt;br /&gt;
      process_github_authors_and_dates(author_name, commit_date[0, 10])&lt;br /&gt;
    end&lt;br /&gt;
    organize_commit_dates&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def make_github_api_request(data)&lt;br /&gt;
    uri = URI.parse(&amp;quot;https://api.github.com/graphql&amp;quot;)&lt;br /&gt;
    http = Net::HTTP.new(uri.host, uri.port)&lt;br /&gt;
    http.use_ssl = true&lt;br /&gt;
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER&lt;br /&gt;
    request = Net::HTTP::Post.new(uri.path, 'Authorization' =&amp;gt; 'Bearer' + ' ' + session[&amp;quot;github_access_token&amp;quot;])&lt;br /&gt;
    request.body = data.to_json&lt;br /&gt;
    http.request(request)&lt;br /&gt;
    response = http.request(request)&lt;br /&gt;
    ActiveSupport::JSON.decode(response.body.to_s)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def organize_commit_dates&lt;br /&gt;
    @dates.each_key do |date|&lt;br /&gt;
      @parsed_data.each_value do |commits|&lt;br /&gt;
        commits[date] ||= 0&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    @parsed_data.each {|author, commits| @parsed_data[author] = Hash[commits.sort_by {|date, _commit_count| date }] }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def team_statistics(github_data)&lt;br /&gt;
    @total_additions += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;additions&amp;quot;]&lt;br /&gt;
    @total_deletions += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;deletions&amp;quot;]&lt;br /&gt;
    @total_files_changed += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;changedFiles&amp;quot;]&lt;br /&gt;
    @total_commits += github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;commits&amp;quot;][&amp;quot;totalCount&amp;quot;]&lt;br /&gt;
    pull_request_number = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;number&amp;quot;]&lt;br /&gt;
    @head_refs[pull_request_number] = github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;headRefOid&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
    @merge_status[pull_request_number] = if github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;merged&amp;quot;]&lt;br /&gt;
                                           &amp;quot;MERGED&amp;quot;&lt;br /&gt;
                                         else&lt;br /&gt;
                                           github_data[&amp;quot;data&amp;quot;][&amp;quot;repository&amp;quot;][&amp;quot;pullRequest&amp;quot;][&amp;quot;mergeable&amp;quot;]&lt;br /&gt;
                                         end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def get_query(is_initial_page, hyperlink_data)&lt;br /&gt;
    commit_query_line = if is_initial_page&lt;br /&gt;
                          &amp;quot;commits(first:100){&amp;quot;&lt;br /&gt;
                        else&lt;br /&gt;
                          &amp;quot;commits(first:100, after:&amp;quot; + @end_cursor + &amp;quot;){&amp;quot;&lt;br /&gt;
                        end&lt;br /&gt;
    {&lt;br /&gt;
      query: &amp;quot;query {&lt;br /&gt;
        repository(owner: \&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;owner_name&amp;quot;] + &amp;quot;\&amp;quot;, name:\&amp;quot;&amp;quot; + hyperlink_data[&amp;quot;repository_name&amp;quot;] + &amp;quot;\&amp;quot;) {&lt;br /&gt;
          pullRequest(number: &amp;quot; + hyperlink_data[&amp;quot;pull_request_number&amp;quot;] + &amp;quot;) {&lt;br /&gt;
            number additions deletions changedFiles mergeable merged headRefOid&lt;br /&gt;
              &amp;quot; + commit_query_line + &amp;quot;&lt;br /&gt;
                totalCount&lt;br /&gt;
                  pageInfo{&lt;br /&gt;
                    hasNextPage startCursor endCursor&lt;br /&gt;
                    }&lt;br /&gt;
                      edges{&lt;br /&gt;
                        node{&lt;br /&gt;
                          id  commit{&lt;br /&gt;
                                author{&lt;br /&gt;
                                  name&lt;br /&gt;
                                }&lt;br /&gt;
                               additions deletions changedFiles committedDate&lt;br /&gt;
                        }}}}}}}&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Change 1: GitHub metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate Reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data per team member based on different GitHub metrics (e.g.  lines of code added/changed/removed etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Change 2: Bar chart for # of commits changed by the overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Click on the &amp;quot;Github metrics&amp;quot; link for the team whose metrics you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A new page opens and shows # of commits changed per team member since the start of the assignment, also bottom of the page shows summary from Github submissions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Tests'''===&lt;br /&gt;
&lt;br /&gt;
* Following feature tests were added to the Grades_Controller_Spec.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#get_statuses_for_pull_request&amp;quot; do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(Net::HTTP).to receive(:get) {&amp;quot;{\&amp;quot;team\&amp;quot;:\&amp;quot;rails\&amp;quot;,\&amp;quot;players\&amp;quot;:\&amp;quot;36\&amp;quot;}&amp;quot;}&lt;br /&gt;
    end&lt;br /&gt;
     it 'makes a call to the GitHub API to get status of the head commit passed' do&lt;br /&gt;
      expect(controller.get_statuses_for_pull_request('qwerty123')).to eq({&amp;quot;team&amp;quot; =&amp;gt; &amp;quot;rails&amp;quot;, &amp;quot;players&amp;quot; =&amp;gt; &amp;quot;36&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe '#view_github_metrics' do&lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current participant id and the view action' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(session[&amp;quot;participant_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_submissions&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view' do  &lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current assignment id and the view action' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(session[&amp;quot;assignment_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_scores&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Change-log for Reviewers'''==&lt;br /&gt;
This section will be removed in the final draft. It is just here for convenience of reviewers to know which sections were majorly updated from last review.&lt;br /&gt;
&lt;br /&gt;
* '''Added''' Solution Design for the final implemented design&lt;br /&gt;
* '''Added''' Implemented Solution to show feature additions to Expertiza&lt;br /&gt;
* '''Added''' Feature test cases for Grades controller&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ GitHub API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121431</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121431"/>
		<updated>2018-12-08T23:55:03Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''Teammate Reviews''' under '''View Scores''' functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give a more realistic view of the work contribution of every team member using external tools like GitHub.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from GitHub. &lt;br /&gt;
&lt;br /&gt;
:1. '''Teammate Reviews''' functionality in the View Scores page gauges teammate views on how much other team members contributed to the project. We need to augment this data with data from external tools like GitHub in order to validate that feedback. New metrics will be appended under each student data under the same functionality.&lt;br /&gt;
:2. '''Github Metrics''' under '''View Submissions''' page should include a bar chart that shows number of commits by the team throughout the assignment timeline. This will help instructors to get a team overview, and aid grading process.&lt;br /&gt;
&lt;br /&gt;
While this data will not have marks associated directly, it will prove useful to the instructor in differentiating the performance of team members and hence awarding marks as per contribution. Overall data for the team, like the number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
Previously, view submission does not show work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows peer review amongst teammates. Currently, however, there is no way to validate and verify these reviews.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on GitHub is a solution, but that is inefficient from instructor's/reviewer's perspective as there are many assignments, submissions, and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
==='''Use Case Diagram'''===&lt;br /&gt;
[[File:UC_1.png|none|frame|1. Use Case diagram of two approaches to append 'GitHub contribution metric' in teammate review. 2. Use Case diagram explaining approach to add new column 'GitHub contribution metric' in 'View submission]]&lt;br /&gt;
&lt;br /&gt;
===='''Use Case Diagram Details'''====&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing, and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able to see the team contribution done by each team member in 'View Submissions' page using graph diagrams, as shown in the figure.&lt;br /&gt;
*Instructor will be able to see the work done by each student in 'Teammate Review Tab' with new metrics table appended at the end, as shown in the figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing our end-point for pulling GitHub data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Solution Design'''==&lt;br /&gt;
&lt;br /&gt;
* The Github metrics that need to be integrated with Expertiza were finalized as below. These metrics are captured on a per-user basis:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# Pull Request Status ( includes code climate and Travis CI Build status)&lt;br /&gt;
*#User Github metrics:&lt;br /&gt;
*## Committer ID&lt;br /&gt;
*## Committer Name&lt;br /&gt;
*## Committer email ID&lt;br /&gt;
	&lt;br /&gt;
* A new link &amp;quot;Github Metrics&amp;quot; is provided under “View Submissions” for an assignment in the instructor view.This link opens a new tab and shows a stacked bar chart for number of commits per user vs submission timeline from assignment creation date to the deadline.&lt;br /&gt;
* In &amp;quot;View Scores&amp;quot; for an assignment in the instructor view, under Teammate Reviews tab, a new table for Github Metrics is added, which shows following Github metrics per user:&lt;br /&gt;
:Student Name/ID, Email ID, lines of code added, lines of code deleted, number of commits&lt;br /&gt;
&lt;br /&gt;
* For GitHub integration, we have used GitHub GraphQL API v4. We have used OAuth gem for authentication purpose.&lt;br /&gt;
&lt;br /&gt;
* We parse the link to PR to get data associated with it. We have also handled projects which do not have PR link, but just a link to the repository.&lt;br /&gt;
&lt;br /&gt;
=='''Implemented Solution'''==&lt;br /&gt;
&lt;br /&gt;
==='''Files Modified'''===&lt;br /&gt;
&lt;br /&gt;
* app/controllers/auth_controller.rb&lt;br /&gt;
* app/controllers/grades_controller.rb&lt;br /&gt;
* app/helpers/grades_helper.rb&lt;br /&gt;
* app/views/assignments/list_submissions.html.erb&lt;br /&gt;
* app/views/grades/_tabbing.html.erb&lt;br /&gt;
* app/views/grades/_teammate_reviews_tab.html.erb&lt;br /&gt;
* app/views/grades/view.html.erb&lt;br /&gt;
* app/views/grades/view_team.html.erb&lt;br /&gt;
* config/application.rb&lt;br /&gt;
* config/initializers/load_config.rb&lt;br /&gt;
* config/initializers/omniauth.rb&lt;br /&gt;
* config/routes.rb&lt;br /&gt;
&lt;br /&gt;
==='''Files Added'''===&lt;br /&gt;
&lt;br /&gt;
* app/views/grades/view_github_metrics.html.erb&lt;br /&gt;
* config/github_auth.yml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''First Change'''===&lt;br /&gt;
&lt;br /&gt;
* A new table &amp;quot;Github Metrics&amp;quot; is added under Manage-&amp;gt; Assignments -&amp;gt; View Scores -&amp;gt; Teammate Reviews. Below is the screenshot of the implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter4.png|none|frame|The GitHub metrics table shows results for each team member]]&lt;br /&gt;
&lt;br /&gt;
==='''Second Change'''===&lt;br /&gt;
* The second change is in the View Submissions page, where we have added a link &amp;quot;Github Metrics&amp;quot; to a new page.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter3.png|none|frame|&lt;br /&gt;
At present, view submission shows group assignments are submitted as a single submission and 'view github metric' link shows work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
* The new page appears after clicking on the link &amp;quot;Github metrics&amp;quot;, that shows bar chart for # of commits per day. We have also added other relevant information about Pull Request, such as total commits, lines of code added, lines of code modified, PR merge status, check status.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_3.png|none|frame|The bar chart]]&lt;br /&gt;
[[File:Ooddafter10.png|none|frame|The Github summary]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Change 1: GitHub metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate Reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data per team member based on different GitHub metrics (e.g.  lines of code added/changed/removed etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Change 2: Bar chart for # of commits changed by the overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Click on the &amp;quot;Github metrics&amp;quot; link for the team whose metrics you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A new page opens and shows # of commits changed per team member since the start of the assignment, also bottom of the page shows summary from Github submissions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Tests'''===&lt;br /&gt;
&lt;br /&gt;
* Following feature tests were added to the Grades_Controller_Spec.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#get_statuses_for_pull_request&amp;quot; do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(Net::HTTP).to receive(:get) {&amp;quot;{\&amp;quot;team\&amp;quot;:\&amp;quot;rails\&amp;quot;,\&amp;quot;players\&amp;quot;:\&amp;quot;36\&amp;quot;}&amp;quot;}&lt;br /&gt;
    end&lt;br /&gt;
     it 'makes a call to the GitHub API to get status of the head commit passed' do&lt;br /&gt;
      expect(controller.get_statuses_for_pull_request('qwerty123')).to eq({&amp;quot;team&amp;quot; =&amp;gt; &amp;quot;rails&amp;quot;, &amp;quot;players&amp;quot; =&amp;gt; &amp;quot;36&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe '#view_github_metrics' do&lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current participant id and the view action' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(session[&amp;quot;participant_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_submissions&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view' do  &lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current assignment id and the view action' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(session[&amp;quot;assignment_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_scores&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Change-log for Reviewers'''==&lt;br /&gt;
This section will be removed in the final draft. It is just here for convenience of reviewers to know which sections were majorly updated from last review.&lt;br /&gt;
&lt;br /&gt;
* '''Added''' Solution Design for the final implemented design&lt;br /&gt;
* '''Added''' Implemented Solution to show feature additions to Expertiza&lt;br /&gt;
* '''Added''' Feature test cases for Grades controller&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ GitHub API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter10.png&amp;diff=121430</id>
		<title>File:Ooddafter10.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter10.png&amp;diff=121430"/>
		<updated>2018-12-08T23:53:14Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121429</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121429"/>
		<updated>2018-12-08T23:52:30Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Second Change */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''Teammate Reviews''' under '''View Scores''' functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give a more realistic view of the work contribution of every team member using external tools like GitHub.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from GitHub. &lt;br /&gt;
&lt;br /&gt;
:1. '''Teammate Reviews''' functionality in the View Scores page gauges teammate views on how much other team members contributed to the project. We need to augment this data with data from external tools like GitHub in order to validate that feedback. New metrics will be appended under each student data under the same functionality.&lt;br /&gt;
:2. '''Github Metrics''' under '''View Submissions''' page should include a bar chart that shows number of commits by the team throughout the assignment timeline. This will help instructors to get a team overview, and aid grading process.&lt;br /&gt;
&lt;br /&gt;
While this data will not have marks associated directly, it will prove useful to the instructor in differentiating the performance of team members and hence awarding marks as per contribution. Overall data for the team, like the number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
Previously, view submission does not show work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows peer review amongst teammates. Currently, however, there is no way to validate and verify these reviews.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on GitHub is a solution, but that is inefficient from instructor's/reviewer's perspective as there are many assignments, submissions, and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
==='''Use Case Diagram'''===&lt;br /&gt;
[[File:UC_1.png|none|frame|1. Use Case diagram of two approaches to append 'GitHub contribution metric' in teammate review. 2. Use Case diagram explaining approach to add new column 'GitHub contribution metric' in 'View submission]]&lt;br /&gt;
&lt;br /&gt;
===='''Use Case Diagram Details'''====&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing, and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able to see the team contribution done by each team member in 'View Submissions' page using graph diagrams, as shown in the figure.&lt;br /&gt;
*Instructor will be able to see the work done by each student in 'Teammate Review Tab' with new metrics table appended at the end, as shown in the figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing our end-point for pulling GitHub data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Solution Design'''==&lt;br /&gt;
&lt;br /&gt;
* The Github metrics that need to be integrated with Expertiza were finalized as below. These metrics are captured on a per-user basis:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# Pull Request Status ( includes code climate and Travis CI Build status)&lt;br /&gt;
*#User Github metrics:&lt;br /&gt;
*## Committer ID&lt;br /&gt;
*## Committer Name&lt;br /&gt;
*## Committer email ID&lt;br /&gt;
	&lt;br /&gt;
* A new link &amp;quot;Github Metrics&amp;quot; is provided under “View Submissions” for an assignment in the instructor view.This link opens a new tab and shows a stacked bar chart for number of commits per user vs submission timeline from assignment creation date to the deadline.&lt;br /&gt;
* In &amp;quot;View Scores&amp;quot; for an assignment in the instructor view, under Teammate Reviews tab, a new table for Github Metrics is added, which shows following Github metrics per user:&lt;br /&gt;
:Student Name/ID, Email ID, lines of code added, lines of code deleted, number of commits&lt;br /&gt;
&lt;br /&gt;
* For GitHub integration, we have used GitHub GraphQL API v4. We have used OAuth gem for authentication purpose.&lt;br /&gt;
&lt;br /&gt;
* We parse the link to PR to get data associated with it. We have also handled projects which do not have PR link, but just a link to the repository.&lt;br /&gt;
&lt;br /&gt;
=='''Implemented Solution'''==&lt;br /&gt;
&lt;br /&gt;
==='''Files Modified'''===&lt;br /&gt;
&lt;br /&gt;
* app/controllers/auth_controller.rb&lt;br /&gt;
* app/controllers/grades_controller.rb&lt;br /&gt;
* app/helpers/grades_helper.rb&lt;br /&gt;
* app/views/assignments/list_submissions.html.erb&lt;br /&gt;
* app/views/grades/_tabbing.html.erb&lt;br /&gt;
* app/views/grades/_teammate_reviews_tab.html.erb&lt;br /&gt;
* app/views/grades/view.html.erb&lt;br /&gt;
* app/views/grades/view_team.html.erb&lt;br /&gt;
* config/application.rb&lt;br /&gt;
* config/initializers/load_config.rb&lt;br /&gt;
* config/initializers/omniauth.rb&lt;br /&gt;
* config/routes.rb&lt;br /&gt;
&lt;br /&gt;
==='''Files Added'''===&lt;br /&gt;
&lt;br /&gt;
* app/views/grades/view_github_metrics.html.erb&lt;br /&gt;
* config/github_auth.yml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''First Change'''===&lt;br /&gt;
&lt;br /&gt;
* A new table &amp;quot;Github Metrics&amp;quot; is added under Manage-&amp;gt; Assignments -&amp;gt; View Scores -&amp;gt; Teammate Reviews. Below is the screenshot of the implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter4.png|none|frame|The GitHub metrics table shows results for each team member]]&lt;br /&gt;
&lt;br /&gt;
==='''Second Change'''===&lt;br /&gt;
* The second change is in the View Submissions page, where we have added a link &amp;quot;Github Metrics&amp;quot; to a new page.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter3.png|none|frame|&lt;br /&gt;
At present, view submission shows group assignments are submitted as a single submission and 'view github metric' link shows work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
* The new page appears after clicking on the link &amp;quot;Github metrics&amp;quot;, that shows bar chart for # of commits per day. We have also added other relevant information about Pull Request, such as total commits, lines of code added, lines of code modified, PR merge status, check status.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_3.png|none|frame|The bar chart]]&lt;br /&gt;
[[File:Ooddafter10.png|none|frame|The Github summary]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Change 1: GitHub metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate Reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data per team member based on different GitHub metrics (e.g.  lines of code added/changed/removed etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Change 2: Bar chart for # of commits changed by the overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Click on the &amp;quot;Github metrics&amp;quot; link for the team whose metrics you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A new page opens and shows # of commits changed per team member since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Tests'''===&lt;br /&gt;
&lt;br /&gt;
* Following feature tests were added to the Grades_Controller_Spec.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#get_statuses_for_pull_request&amp;quot; do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(Net::HTTP).to receive(:get) {&amp;quot;{\&amp;quot;team\&amp;quot;:\&amp;quot;rails\&amp;quot;,\&amp;quot;players\&amp;quot;:\&amp;quot;36\&amp;quot;}&amp;quot;}&lt;br /&gt;
    end&lt;br /&gt;
     it 'makes a call to the GitHub API to get status of the head commit passed' do&lt;br /&gt;
      expect(controller.get_statuses_for_pull_request('qwerty123')).to eq({&amp;quot;team&amp;quot; =&amp;gt; &amp;quot;rails&amp;quot;, &amp;quot;players&amp;quot; =&amp;gt; &amp;quot;36&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe '#view_github_metrics' do&lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current participant id and the view action' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(session[&amp;quot;participant_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_submissions&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view' do  &lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current assignment id and the view action' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(session[&amp;quot;assignment_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_scores&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Change-log for Reviewers'''==&lt;br /&gt;
This section will be removed in the final draft. It is just here for convenience of reviewers to know which sections were majorly updated from last review.&lt;br /&gt;
&lt;br /&gt;
* '''Added''' Solution Design for the final implemented design&lt;br /&gt;
* '''Added''' Implemented Solution to show feature additions to Expertiza&lt;br /&gt;
* '''Added''' Feature test cases for Grades controller&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ GitHub API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter5.PNG&amp;diff=121428</id>
		<title>File:Ooddafter5.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter5.PNG&amp;diff=121428"/>
		<updated>2018-12-08T23:49:47Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121427</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121427"/>
		<updated>2018-12-08T23:49:22Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Second Change */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''Teammate Reviews''' under '''View Scores''' functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give a more realistic view of the work contribution of every team member using external tools like GitHub.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from GitHub. &lt;br /&gt;
&lt;br /&gt;
:1. '''Teammate Reviews''' functionality in the View Scores page gauges teammate views on how much other team members contributed to the project. We need to augment this data with data from external tools like GitHub in order to validate that feedback. New metrics will be appended under each student data under the same functionality.&lt;br /&gt;
:2. '''Github Metrics''' under '''View Submissions''' page should include a bar chart that shows number of commits by the team throughout the assignment timeline. This will help instructors to get a team overview, and aid grading process.&lt;br /&gt;
&lt;br /&gt;
While this data will not have marks associated directly, it will prove useful to the instructor in differentiating the performance of team members and hence awarding marks as per contribution. Overall data for the team, like the number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
Previously, view submission does not show work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows peer review amongst teammates. Currently, however, there is no way to validate and verify these reviews.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on GitHub is a solution, but that is inefficient from instructor's/reviewer's perspective as there are many assignments, submissions, and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
==='''Use Case Diagram'''===&lt;br /&gt;
[[File:UC_1.png|none|frame|1. Use Case diagram of two approaches to append 'GitHub contribution metric' in teammate review. 2. Use Case diagram explaining approach to add new column 'GitHub contribution metric' in 'View submission]]&lt;br /&gt;
&lt;br /&gt;
===='''Use Case Diagram Details'''====&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing, and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able to see the team contribution done by each team member in 'View Submissions' page using graph diagrams, as shown in the figure.&lt;br /&gt;
*Instructor will be able to see the work done by each student in 'Teammate Review Tab' with new metrics table appended at the end, as shown in the figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing our end-point for pulling GitHub data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Solution Design'''==&lt;br /&gt;
&lt;br /&gt;
* The Github metrics that need to be integrated with Expertiza were finalized as below. These metrics are captured on a per-user basis:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# Pull Request Status ( includes code climate and Travis CI Build status)&lt;br /&gt;
*#User Github metrics:&lt;br /&gt;
*## Committer ID&lt;br /&gt;
*## Committer Name&lt;br /&gt;
*## Committer email ID&lt;br /&gt;
	&lt;br /&gt;
* A new link &amp;quot;Github Metrics&amp;quot; is provided under “View Submissions” for an assignment in the instructor view.This link opens a new tab and shows a stacked bar chart for number of commits per user vs submission timeline from assignment creation date to the deadline.&lt;br /&gt;
* In &amp;quot;View Scores&amp;quot; for an assignment in the instructor view, under Teammate Reviews tab, a new table for Github Metrics is added, which shows following Github metrics per user:&lt;br /&gt;
:Student Name/ID, Email ID, lines of code added, lines of code deleted, number of commits&lt;br /&gt;
&lt;br /&gt;
* For GitHub integration, we have used GitHub GraphQL API v4. We have used OAuth gem for authentication purpose.&lt;br /&gt;
&lt;br /&gt;
* We parse the link to PR to get data associated with it. We have also handled projects which do not have PR link, but just a link to the repository.&lt;br /&gt;
&lt;br /&gt;
=='''Implemented Solution'''==&lt;br /&gt;
&lt;br /&gt;
==='''Files Modified'''===&lt;br /&gt;
&lt;br /&gt;
* app/controllers/auth_controller.rb&lt;br /&gt;
* app/controllers/grades_controller.rb&lt;br /&gt;
* app/helpers/grades_helper.rb&lt;br /&gt;
* app/views/assignments/list_submissions.html.erb&lt;br /&gt;
* app/views/grades/_tabbing.html.erb&lt;br /&gt;
* app/views/grades/_teammate_reviews_tab.html.erb&lt;br /&gt;
* app/views/grades/view.html.erb&lt;br /&gt;
* app/views/grades/view_team.html.erb&lt;br /&gt;
* config/application.rb&lt;br /&gt;
* config/initializers/load_config.rb&lt;br /&gt;
* config/initializers/omniauth.rb&lt;br /&gt;
* config/routes.rb&lt;br /&gt;
&lt;br /&gt;
==='''Files Added'''===&lt;br /&gt;
&lt;br /&gt;
* app/views/grades/view_github_metrics.html.erb&lt;br /&gt;
* config/github_auth.yml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''First Change'''===&lt;br /&gt;
&lt;br /&gt;
* A new table &amp;quot;Github Metrics&amp;quot; is added under Manage-&amp;gt; Assignments -&amp;gt; View Scores -&amp;gt; Teammate Reviews. Below is the screenshot of the implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter4.png|none|frame|The GitHub metrics table shows results for each team member]]&lt;br /&gt;
&lt;br /&gt;
==='''Second Change'''===&lt;br /&gt;
* The second change is in the View Submissions page, where we have added a link &amp;quot;Github Metrics&amp;quot; to a new page.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter3.png|none|frame|&lt;br /&gt;
At present, view submission shows group assignments are submitted as a single submission and 'view github metric' link shows work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
* The new page appears after clicking on the link &amp;quot;Github metrics&amp;quot;, that shows bar chart for # of commits per day. We have also added other relevant information about Pull Request, such as total commits, lines of code added, lines of code modified, PR merge status, check status.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_3.png|none|frame|The bar chart]]&lt;br /&gt;
[[File:Ooddafter5.png|none|frame|The Github summary]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Change 1: GitHub metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate Reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data per team member based on different GitHub metrics (e.g.  lines of code added/changed/removed etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Change 2: Bar chart for # of commits changed by the overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Click on the &amp;quot;Github metrics&amp;quot; link for the team whose metrics you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A new page opens and shows # of commits changed per team member since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Tests'''===&lt;br /&gt;
&lt;br /&gt;
* Following feature tests were added to the Grades_Controller_Spec.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#get_statuses_for_pull_request&amp;quot; do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(Net::HTTP).to receive(:get) {&amp;quot;{\&amp;quot;team\&amp;quot;:\&amp;quot;rails\&amp;quot;,\&amp;quot;players\&amp;quot;:\&amp;quot;36\&amp;quot;}&amp;quot;}&lt;br /&gt;
    end&lt;br /&gt;
     it 'makes a call to the GitHub API to get status of the head commit passed' do&lt;br /&gt;
      expect(controller.get_statuses_for_pull_request('qwerty123')).to eq({&amp;quot;team&amp;quot; =&amp;gt; &amp;quot;rails&amp;quot;, &amp;quot;players&amp;quot; =&amp;gt; &amp;quot;36&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe '#view_github_metrics' do&lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current participant id and the view action' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(session[&amp;quot;participant_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_submissions&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view' do  &lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current assignment id and the view action' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(session[&amp;quot;assignment_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_scores&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Change-log for Reviewers'''==&lt;br /&gt;
This section will be removed in the final draft. It is just here for convenience of reviewers to know which sections were majorly updated from last review.&lt;br /&gt;
&lt;br /&gt;
* '''Added''' Solution Design for the final implemented design&lt;br /&gt;
* '''Added''' Implemented Solution to show feature additions to Expertiza&lt;br /&gt;
* '''Added''' Feature test cases for Grades controller&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ GitHub API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121426</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121426"/>
		<updated>2018-12-08T23:46:24Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* First Change */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''Teammate Reviews''' under '''View Scores''' functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give a more realistic view of the work contribution of every team member using external tools like GitHub.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from GitHub. &lt;br /&gt;
&lt;br /&gt;
:1. '''Teammate Reviews''' functionality in the View Scores page gauges teammate views on how much other team members contributed to the project. We need to augment this data with data from external tools like GitHub in order to validate that feedback. New metrics will be appended under each student data under the same functionality.&lt;br /&gt;
:2. '''Github Metrics''' under '''View Submissions''' page should include a bar chart that shows number of commits by the team throughout the assignment timeline. This will help instructors to get a team overview, and aid grading process.&lt;br /&gt;
&lt;br /&gt;
While this data will not have marks associated directly, it will prove useful to the instructor in differentiating the performance of team members and hence awarding marks as per contribution. Overall data for the team, like the number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
Previously, view submission does not show work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows peer review amongst teammates. Currently, however, there is no way to validate and verify these reviews.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on GitHub is a solution, but that is inefficient from instructor's/reviewer's perspective as there are many assignments, submissions, and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
==='''Use Case Diagram'''===&lt;br /&gt;
[[File:UC_1.png|none|frame|1. Use Case diagram of two approaches to append 'GitHub contribution metric' in teammate review. 2. Use Case diagram explaining approach to add new column 'GitHub contribution metric' in 'View submission]]&lt;br /&gt;
&lt;br /&gt;
===='''Use Case Diagram Details'''====&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing, and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able to see the team contribution done by each team member in 'View Submissions' page using graph diagrams, as shown in the figure.&lt;br /&gt;
*Instructor will be able to see the work done by each student in 'Teammate Review Tab' with new metrics table appended at the end, as shown in the figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing our end-point for pulling GitHub data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Solution Design'''==&lt;br /&gt;
&lt;br /&gt;
* The Github metrics that need to be integrated with Expertiza were finalized as below. These metrics are captured on a per-user basis:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# Pull Request Status ( includes code climate and Travis CI Build status)&lt;br /&gt;
*#User Github metrics:&lt;br /&gt;
*## Committer ID&lt;br /&gt;
*## Committer Name&lt;br /&gt;
*## Committer email ID&lt;br /&gt;
	&lt;br /&gt;
* A new link &amp;quot;Github Metrics&amp;quot; is provided under “View Submissions” for an assignment in the instructor view.This link opens a new tab and shows a stacked bar chart for number of commits per user vs submission timeline from assignment creation date to the deadline.&lt;br /&gt;
* In &amp;quot;View Scores&amp;quot; for an assignment in the instructor view, under Teammate Reviews tab, a new table for Github Metrics is added, which shows following Github metrics per user:&lt;br /&gt;
:Student Name/ID, Email ID, lines of code added, lines of code deleted, number of commits&lt;br /&gt;
&lt;br /&gt;
* For GitHub integration, we have used GitHub GraphQL API v4. We have used OAuth gem for authentication purpose.&lt;br /&gt;
&lt;br /&gt;
* We parse the link to PR to get data associated with it. We have also handled projects which do not have PR link, but just a link to the repository.&lt;br /&gt;
&lt;br /&gt;
=='''Implemented Solution'''==&lt;br /&gt;
&lt;br /&gt;
==='''Files Modified'''===&lt;br /&gt;
&lt;br /&gt;
* app/controllers/auth_controller.rb&lt;br /&gt;
* app/controllers/grades_controller.rb&lt;br /&gt;
* app/helpers/grades_helper.rb&lt;br /&gt;
* app/views/assignments/list_submissions.html.erb&lt;br /&gt;
* app/views/grades/_tabbing.html.erb&lt;br /&gt;
* app/views/grades/_teammate_reviews_tab.html.erb&lt;br /&gt;
* app/views/grades/view.html.erb&lt;br /&gt;
* app/views/grades/view_team.html.erb&lt;br /&gt;
* config/application.rb&lt;br /&gt;
* config/initializers/load_config.rb&lt;br /&gt;
* config/initializers/omniauth.rb&lt;br /&gt;
* config/routes.rb&lt;br /&gt;
&lt;br /&gt;
==='''Files Added'''===&lt;br /&gt;
&lt;br /&gt;
* app/views/grades/view_github_metrics.html.erb&lt;br /&gt;
* config/github_auth.yml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''First Change'''===&lt;br /&gt;
&lt;br /&gt;
* A new table &amp;quot;Github Metrics&amp;quot; is added under Manage-&amp;gt; Assignments -&amp;gt; View Scores -&amp;gt; Teammate Reviews. Below is the screenshot of the implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter4.png|none|frame|The GitHub metrics table shows results for each team member]]&lt;br /&gt;
&lt;br /&gt;
==='''Second Change'''===&lt;br /&gt;
* The second change is in the View Submissions page, where we have added a link &amp;quot;Github Metrics&amp;quot; to a new page.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter3.png|none|frame|&lt;br /&gt;
At present, view submission shows group assignments are submitted as a single submission and 'view github metric' link shows work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
* The new page appears after clicking on the link &amp;quot;Github metrics&amp;quot;, that shows bar chart for # of commits per day. We have also added other relevant information about Pull Request, such as total commits, lines of code added, lines of code modified, PR merge status, check status.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_3.png|none|frame|The bar chart]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Change 1: GitHub metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate Reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data per team member based on different GitHub metrics (e.g.  lines of code added/changed/removed etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Change 2: Bar chart for # of commits changed by the overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Click on the &amp;quot;Github metrics&amp;quot; link for the team whose metrics you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A new page opens and shows # of commits changed per team member since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Tests'''===&lt;br /&gt;
&lt;br /&gt;
* Following feature tests were added to the Grades_Controller_Spec.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#get_statuses_for_pull_request&amp;quot; do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(Net::HTTP).to receive(:get) {&amp;quot;{\&amp;quot;team\&amp;quot;:\&amp;quot;rails\&amp;quot;,\&amp;quot;players\&amp;quot;:\&amp;quot;36\&amp;quot;}&amp;quot;}&lt;br /&gt;
    end&lt;br /&gt;
     it 'makes a call to the GitHub API to get status of the head commit passed' do&lt;br /&gt;
      expect(controller.get_statuses_for_pull_request('qwerty123')).to eq({&amp;quot;team&amp;quot; =&amp;gt; &amp;quot;rails&amp;quot;, &amp;quot;players&amp;quot; =&amp;gt; &amp;quot;36&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe '#view_github_metrics' do&lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current participant id and the view action' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(session[&amp;quot;participant_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_submissions&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view' do  &lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current assignment id and the view action' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(session[&amp;quot;assignment_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_scores&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Change-log for Reviewers'''==&lt;br /&gt;
This section will be removed in the final draft. It is just here for convenience of reviewers to know which sections were majorly updated from last review.&lt;br /&gt;
&lt;br /&gt;
* '''Added''' Solution Design for the final implemented design&lt;br /&gt;
* '''Added''' Implemented Solution to show feature additions to Expertiza&lt;br /&gt;
* '''Added''' Feature test cases for Grades controller&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ GitHub API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter4.png&amp;diff=121425</id>
		<title>File:Ooddafter4.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter4.png&amp;diff=121425"/>
		<updated>2018-12-08T23:45:46Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121424</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121424"/>
		<updated>2018-12-08T23:39:24Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Second Change */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''Teammate Reviews''' under '''View Scores''' functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give a more realistic view of the work contribution of every team member using external tools like GitHub.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from GitHub. &lt;br /&gt;
&lt;br /&gt;
:1. '''Teammate Reviews''' functionality in the View Scores page gauges teammate views on how much other team members contributed to the project. We need to augment this data with data from external tools like GitHub in order to validate that feedback. New metrics will be appended under each student data under the same functionality.&lt;br /&gt;
:2. '''Github Metrics''' under '''View Submissions''' page should include a bar chart that shows number of commits by the team throughout the assignment timeline. This will help instructors to get a team overview, and aid grading process.&lt;br /&gt;
&lt;br /&gt;
While this data will not have marks associated directly, it will prove useful to the instructor in differentiating the performance of team members and hence awarding marks as per contribution. Overall data for the team, like the number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
Previously, view submission does not show work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows peer review amongst teammates. Currently, however, there is no way to validate and verify these reviews.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on GitHub is a solution, but that is inefficient from instructor's/reviewer's perspective as there are many assignments, submissions, and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
==='''Use Case Diagram'''===&lt;br /&gt;
[[File:UC_1.png|none|frame|1. Use Case diagram of two approaches to append 'GitHub contribution metric' in teammate review. 2. Use Case diagram explaining approach to add new column 'GitHub contribution metric' in 'View submission]]&lt;br /&gt;
&lt;br /&gt;
===='''Use Case Diagram Details'''====&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing, and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able to see the team contribution done by each team member in 'View Submissions' page using graph diagrams, as shown in the figure.&lt;br /&gt;
*Instructor will be able to see the work done by each student in 'Teammate Review Tab' with new metrics table appended at the end, as shown in the figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing our end-point for pulling GitHub data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Solution Design'''==&lt;br /&gt;
&lt;br /&gt;
* The Github metrics that need to be integrated with Expertiza were finalized as below. These metrics are captured on a per-user basis:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# Pull Request Status ( includes code climate and Travis CI Build status)&lt;br /&gt;
*#User Github metrics:&lt;br /&gt;
*## Committer ID&lt;br /&gt;
*## Committer Name&lt;br /&gt;
*## Committer email ID&lt;br /&gt;
	&lt;br /&gt;
* A new link &amp;quot;Github Metrics&amp;quot; is provided under “View Submissions” for an assignment in the instructor view.This link opens a new tab and shows a stacked bar chart for number of commits per user vs submission timeline from assignment creation date to the deadline.&lt;br /&gt;
* In &amp;quot;View Scores&amp;quot; for an assignment in the instructor view, under Teammate Reviews tab, a new table for Github Metrics is added, which shows following Github metrics per user:&lt;br /&gt;
:Student Name/ID, Email ID, lines of code added, lines of code deleted, number of commits&lt;br /&gt;
&lt;br /&gt;
* For GitHub integration, we have used GitHub GraphQL API v4. We have used OAuth gem for authentication purpose.&lt;br /&gt;
&lt;br /&gt;
* We parse the link to PR to get data associated with it. We have also handled projects which do not have PR link, but just a link to the repository.&lt;br /&gt;
&lt;br /&gt;
=='''Implemented Solution'''==&lt;br /&gt;
&lt;br /&gt;
==='''Files Modified'''===&lt;br /&gt;
&lt;br /&gt;
* app/controllers/auth_controller.rb&lt;br /&gt;
* app/controllers/grades_controller.rb&lt;br /&gt;
* app/helpers/grades_helper.rb&lt;br /&gt;
* app/views/assignments/list_submissions.html.erb&lt;br /&gt;
* app/views/grades/_tabbing.html.erb&lt;br /&gt;
* app/views/grades/_teammate_reviews_tab.html.erb&lt;br /&gt;
* app/views/grades/view.html.erb&lt;br /&gt;
* app/views/grades/view_team.html.erb&lt;br /&gt;
* config/application.rb&lt;br /&gt;
* config/initializers/load_config.rb&lt;br /&gt;
* config/initializers/omniauth.rb&lt;br /&gt;
* config/routes.rb&lt;br /&gt;
&lt;br /&gt;
==='''Files Added'''===&lt;br /&gt;
&lt;br /&gt;
* app/views/grades/view_github_metrics.html.erb&lt;br /&gt;
* config/github_auth.yml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''First Change'''===&lt;br /&gt;
&lt;br /&gt;
* A new table &amp;quot;Github Metrics&amp;quot; is added under Manage-&amp;gt; Assignments -&amp;gt; View Scores -&amp;gt; Teammate Reviews. Below is the screenshot of the implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_1.png|none|frame|The GitHub metrics table shows results for each team member]]&lt;br /&gt;
&lt;br /&gt;
==='''Second Change'''===&lt;br /&gt;
* The second change is in the View Submissions page, where we have added a link &amp;quot;Github Metrics&amp;quot; to a new page.&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter3.png|none|frame|&lt;br /&gt;
At present, view submission shows group assignments are submitted as a single submission and 'view github metric' link shows work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
* The new page appears after clicking on the link &amp;quot;Github metrics&amp;quot;, that shows bar chart for # of commits per day. We have also added other relevant information about Pull Request, such as total commits, lines of code added, lines of code modified, PR merge status, check status.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_3.png|none|frame|The bar chart]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Change 1: GitHub metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate Reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data per team member based on different GitHub metrics (e.g.  lines of code added/changed/removed etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Change 2: Bar chart for # of commits changed by the overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Click on the &amp;quot;Github metrics&amp;quot; link for the team whose metrics you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A new page opens and shows # of commits changed per team member since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Tests'''===&lt;br /&gt;
&lt;br /&gt;
* Following feature tests were added to the Grades_Controller_Spec.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#get_statuses_for_pull_request&amp;quot; do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(Net::HTTP).to receive(:get) {&amp;quot;{\&amp;quot;team\&amp;quot;:\&amp;quot;rails\&amp;quot;,\&amp;quot;players\&amp;quot;:\&amp;quot;36\&amp;quot;}&amp;quot;}&lt;br /&gt;
    end&lt;br /&gt;
     it 'makes a call to the GitHub API to get status of the head commit passed' do&lt;br /&gt;
      expect(controller.get_statuses_for_pull_request('qwerty123')).to eq({&amp;quot;team&amp;quot; =&amp;gt; &amp;quot;rails&amp;quot;, &amp;quot;players&amp;quot; =&amp;gt; &amp;quot;36&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe '#view_github_metrics' do&lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current participant id and the view action' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(session[&amp;quot;participant_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_submissions&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view' do  &lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current assignment id and the view action' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(session[&amp;quot;assignment_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_scores&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Change-log for Reviewers'''==&lt;br /&gt;
This section will be removed in the final draft. It is just here for convenience of reviewers to know which sections were majorly updated from last review.&lt;br /&gt;
&lt;br /&gt;
* '''Added''' Solution Design for the final implemented design&lt;br /&gt;
* '''Added''' Implemented Solution to show feature additions to Expertiza&lt;br /&gt;
* '''Added''' Feature test cases for Grades controller&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ GitHub API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121423</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121423"/>
		<updated>2018-12-08T23:38:26Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Current Scenario */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''Teammate Reviews''' under '''View Scores''' functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give a more realistic view of the work contribution of every team member using external tools like GitHub.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from GitHub. &lt;br /&gt;
&lt;br /&gt;
:1. '''Teammate Reviews''' functionality in the View Scores page gauges teammate views on how much other team members contributed to the project. We need to augment this data with data from external tools like GitHub in order to validate that feedback. New metrics will be appended under each student data under the same functionality.&lt;br /&gt;
:2. '''Github Metrics''' under '''View Submissions''' page should include a bar chart that shows number of commits by the team throughout the assignment timeline. This will help instructors to get a team overview, and aid grading process.&lt;br /&gt;
&lt;br /&gt;
While this data will not have marks associated directly, it will prove useful to the instructor in differentiating the performance of team members and hence awarding marks as per contribution. Overall data for the team, like the number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
Previously, view submission does not show work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows peer review amongst teammates. Currently, however, there is no way to validate and verify these reviews.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on GitHub is a solution, but that is inefficient from instructor's/reviewer's perspective as there are many assignments, submissions, and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
==='''Use Case Diagram'''===&lt;br /&gt;
[[File:UC_1.png|none|frame|1. Use Case diagram of two approaches to append 'GitHub contribution metric' in teammate review. 2. Use Case diagram explaining approach to add new column 'GitHub contribution metric' in 'View submission]]&lt;br /&gt;
&lt;br /&gt;
===='''Use Case Diagram Details'''====&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing, and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able to see the team contribution done by each team member in 'View Submissions' page using graph diagrams, as shown in the figure.&lt;br /&gt;
*Instructor will be able to see the work done by each student in 'Teammate Review Tab' with new metrics table appended at the end, as shown in the figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing our end-point for pulling GitHub data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Solution Design'''==&lt;br /&gt;
&lt;br /&gt;
* The Github metrics that need to be integrated with Expertiza were finalized as below. These metrics are captured on a per-user basis:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# Pull Request Status ( includes code climate and Travis CI Build status)&lt;br /&gt;
*#User Github metrics:&lt;br /&gt;
*## Committer ID&lt;br /&gt;
*## Committer Name&lt;br /&gt;
*## Committer email ID&lt;br /&gt;
	&lt;br /&gt;
* A new link &amp;quot;Github Metrics&amp;quot; is provided under “View Submissions” for an assignment in the instructor view.This link opens a new tab and shows a stacked bar chart for number of commits per user vs submission timeline from assignment creation date to the deadline.&lt;br /&gt;
* In &amp;quot;View Scores&amp;quot; for an assignment in the instructor view, under Teammate Reviews tab, a new table for Github Metrics is added, which shows following Github metrics per user:&lt;br /&gt;
:Student Name/ID, Email ID, lines of code added, lines of code deleted, number of commits&lt;br /&gt;
&lt;br /&gt;
* For GitHub integration, we have used GitHub GraphQL API v4. We have used OAuth gem for authentication purpose.&lt;br /&gt;
&lt;br /&gt;
* We parse the link to PR to get data associated with it. We have also handled projects which do not have PR link, but just a link to the repository.&lt;br /&gt;
&lt;br /&gt;
=='''Implemented Solution'''==&lt;br /&gt;
&lt;br /&gt;
==='''Files Modified'''===&lt;br /&gt;
&lt;br /&gt;
* app/controllers/auth_controller.rb&lt;br /&gt;
* app/controllers/grades_controller.rb&lt;br /&gt;
* app/helpers/grades_helper.rb&lt;br /&gt;
* app/views/assignments/list_submissions.html.erb&lt;br /&gt;
* app/views/grades/_tabbing.html.erb&lt;br /&gt;
* app/views/grades/_teammate_reviews_tab.html.erb&lt;br /&gt;
* app/views/grades/view.html.erb&lt;br /&gt;
* app/views/grades/view_team.html.erb&lt;br /&gt;
* config/application.rb&lt;br /&gt;
* config/initializers/load_config.rb&lt;br /&gt;
* config/initializers/omniauth.rb&lt;br /&gt;
* config/routes.rb&lt;br /&gt;
&lt;br /&gt;
==='''Files Added'''===&lt;br /&gt;
&lt;br /&gt;
* app/views/grades/view_github_metrics.html.erb&lt;br /&gt;
* config/github_auth.yml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''First Change'''===&lt;br /&gt;
&lt;br /&gt;
* A new table &amp;quot;Github Metrics&amp;quot; is added under Manage-&amp;gt; Assignments -&amp;gt; View Scores -&amp;gt; Teammate Reviews. Below is the screenshot of the implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_1.png|none|frame|The GitHub metrics table shows results for each team member]]&lt;br /&gt;
&lt;br /&gt;
==='''Second Change'''===&lt;br /&gt;
* The second change is in the View Submissions page, where we have added a link &amp;quot;Github Metrics&amp;quot; to a new page.&lt;br /&gt;
[[File:Capture_2.png|none|frame|The GitHub metrics link can be seen below Assign Grade link]]&lt;br /&gt;
&lt;br /&gt;
* The new page appears after clicking on the link &amp;quot;Github metrics&amp;quot;, that shows bar chart for # of commits per day. We have also added other relevant information about Pull Request, such as total commits, lines of code added, lines of code modified, PR merge status, check status.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_3.png|none|frame|The bar chart]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Change 1: GitHub metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate Reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data per team member based on different GitHub metrics (e.g.  lines of code added/changed/removed etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Change 2: Bar chart for # of commits changed by the overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Click on the &amp;quot;Github metrics&amp;quot; link for the team whose metrics you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A new page opens and shows # of commits changed per team member since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Tests'''===&lt;br /&gt;
&lt;br /&gt;
* Following feature tests were added to the Grades_Controller_Spec.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#get_statuses_for_pull_request&amp;quot; do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(Net::HTTP).to receive(:get) {&amp;quot;{\&amp;quot;team\&amp;quot;:\&amp;quot;rails\&amp;quot;,\&amp;quot;players\&amp;quot;:\&amp;quot;36\&amp;quot;}&amp;quot;}&lt;br /&gt;
    end&lt;br /&gt;
     it 'makes a call to the GitHub API to get status of the head commit passed' do&lt;br /&gt;
      expect(controller.get_statuses_for_pull_request('qwerty123')).to eq({&amp;quot;team&amp;quot; =&amp;gt; &amp;quot;rails&amp;quot;, &amp;quot;players&amp;quot; =&amp;gt; &amp;quot;36&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe '#view_github_metrics' do&lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current participant id and the view action' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(session[&amp;quot;participant_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_submissions&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view' do  &lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current assignment id and the view action' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(session[&amp;quot;assignment_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_scores&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Change-log for Reviewers'''==&lt;br /&gt;
This section will be removed in the final draft. It is just here for convenience of reviewers to know which sections were majorly updated from last review.&lt;br /&gt;
&lt;br /&gt;
* '''Added''' Solution Design for the final implemented design&lt;br /&gt;
* '''Added''' Implemented Solution to show feature additions to Expertiza&lt;br /&gt;
* '''Added''' Feature test cases for Grades controller&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ GitHub API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121422</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121422"/>
		<updated>2018-12-08T23:37:29Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Current Scenario */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''Teammate Reviews''' under '''View Scores''' functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give a more realistic view of the work contribution of every team member using external tools like GitHub.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from GitHub. &lt;br /&gt;
&lt;br /&gt;
:1. '''Teammate Reviews''' functionality in the View Scores page gauges teammate views on how much other team members contributed to the project. We need to augment this data with data from external tools like GitHub in order to validate that feedback. New metrics will be appended under each student data under the same functionality.&lt;br /&gt;
:2. '''Github Metrics''' under '''View Submissions''' page should include a bar chart that shows number of commits by the team throughout the assignment timeline. This will help instructors to get a team overview, and aid grading process.&lt;br /&gt;
&lt;br /&gt;
While this data will not have marks associated directly, it will prove useful to the instructor in differentiating the performance of team members and hence awarding marks as per contribution. Overall data for the team, like the number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
Previously, view submission does not show work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
[[File:Ooddafter3.png|none|frame|&lt;br /&gt;
At present, view submission shows group assignments are submitted as a single submission and 'view github metric' link shows work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows peer review amongst teammates. Currently, however, there is no way to validate and verify these reviews.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on GitHub is a solution, but that is inefficient from instructor's/reviewer's perspective as there are many assignments, submissions, and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
==='''Use Case Diagram'''===&lt;br /&gt;
[[File:UC_1.png|none|frame|1. Use Case diagram of two approaches to append 'GitHub contribution metric' in teammate review. 2. Use Case diagram explaining approach to add new column 'GitHub contribution metric' in 'View submission]]&lt;br /&gt;
&lt;br /&gt;
===='''Use Case Diagram Details'''====&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing, and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able to see the team contribution done by each team member in 'View Submissions' page using graph diagrams, as shown in the figure.&lt;br /&gt;
*Instructor will be able to see the work done by each student in 'Teammate Review Tab' with new metrics table appended at the end, as shown in the figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing our end-point for pulling GitHub data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Solution Design'''==&lt;br /&gt;
&lt;br /&gt;
* The Github metrics that need to be integrated with Expertiza were finalized as below. These metrics are captured on a per-user basis:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# Pull Request Status ( includes code climate and Travis CI Build status)&lt;br /&gt;
*#User Github metrics:&lt;br /&gt;
*## Committer ID&lt;br /&gt;
*## Committer Name&lt;br /&gt;
*## Committer email ID&lt;br /&gt;
	&lt;br /&gt;
* A new link &amp;quot;Github Metrics&amp;quot; is provided under “View Submissions” for an assignment in the instructor view.This link opens a new tab and shows a stacked bar chart for number of commits per user vs submission timeline from assignment creation date to the deadline.&lt;br /&gt;
* In &amp;quot;View Scores&amp;quot; for an assignment in the instructor view, under Teammate Reviews tab, a new table for Github Metrics is added, which shows following Github metrics per user:&lt;br /&gt;
:Student Name/ID, Email ID, lines of code added, lines of code deleted, number of commits&lt;br /&gt;
&lt;br /&gt;
* For GitHub integration, we have used GitHub GraphQL API v4. We have used OAuth gem for authentication purpose.&lt;br /&gt;
&lt;br /&gt;
* We parse the link to PR to get data associated with it. We have also handled projects which do not have PR link, but just a link to the repository.&lt;br /&gt;
&lt;br /&gt;
=='''Implemented Solution'''==&lt;br /&gt;
&lt;br /&gt;
==='''Files Modified'''===&lt;br /&gt;
&lt;br /&gt;
* app/controllers/auth_controller.rb&lt;br /&gt;
* app/controllers/grades_controller.rb&lt;br /&gt;
* app/helpers/grades_helper.rb&lt;br /&gt;
* app/views/assignments/list_submissions.html.erb&lt;br /&gt;
* app/views/grades/_tabbing.html.erb&lt;br /&gt;
* app/views/grades/_teammate_reviews_tab.html.erb&lt;br /&gt;
* app/views/grades/view.html.erb&lt;br /&gt;
* app/views/grades/view_team.html.erb&lt;br /&gt;
* config/application.rb&lt;br /&gt;
* config/initializers/load_config.rb&lt;br /&gt;
* config/initializers/omniauth.rb&lt;br /&gt;
* config/routes.rb&lt;br /&gt;
&lt;br /&gt;
==='''Files Added'''===&lt;br /&gt;
&lt;br /&gt;
* app/views/grades/view_github_metrics.html.erb&lt;br /&gt;
* config/github_auth.yml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''First Change'''===&lt;br /&gt;
&lt;br /&gt;
* A new table &amp;quot;Github Metrics&amp;quot; is added under Manage-&amp;gt; Assignments -&amp;gt; View Scores -&amp;gt; Teammate Reviews. Below is the screenshot of the implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_1.png|none|frame|The GitHub metrics table shows results for each team member]]&lt;br /&gt;
&lt;br /&gt;
==='''Second Change'''===&lt;br /&gt;
* The second change is in the View Submissions page, where we have added a link &amp;quot;Github Metrics&amp;quot; to a new page.&lt;br /&gt;
[[File:Capture_2.png|none|frame|The GitHub metrics link can be seen below Assign Grade link]]&lt;br /&gt;
&lt;br /&gt;
* The new page appears after clicking on the link &amp;quot;Github metrics&amp;quot;, that shows bar chart for # of commits per day. We have also added other relevant information about Pull Request, such as total commits, lines of code added, lines of code modified, PR merge status, check status.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_3.png|none|frame|The bar chart]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Change 1: GitHub metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate Reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data per team member based on different GitHub metrics (e.g.  lines of code added/changed/removed etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Change 2: Bar chart for # of commits changed by the overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Click on the &amp;quot;Github metrics&amp;quot; link for the team whose metrics you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A new page opens and shows # of commits changed per team member since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Tests'''===&lt;br /&gt;
&lt;br /&gt;
* Following feature tests were added to the Grades_Controller_Spec.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#get_statuses_for_pull_request&amp;quot; do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(Net::HTTP).to receive(:get) {&amp;quot;{\&amp;quot;team\&amp;quot;:\&amp;quot;rails\&amp;quot;,\&amp;quot;players\&amp;quot;:\&amp;quot;36\&amp;quot;}&amp;quot;}&lt;br /&gt;
    end&lt;br /&gt;
     it 'makes a call to the GitHub API to get status of the head commit passed' do&lt;br /&gt;
      expect(controller.get_statuses_for_pull_request('qwerty123')).to eq({&amp;quot;team&amp;quot; =&amp;gt; &amp;quot;rails&amp;quot;, &amp;quot;players&amp;quot; =&amp;gt; &amp;quot;36&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe '#view_github_metrics' do&lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current participant id and the view action' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(session[&amp;quot;participant_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_submissions&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view' do  &lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current assignment id and the view action' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(session[&amp;quot;assignment_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_scores&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Change-log for Reviewers'''==&lt;br /&gt;
This section will be removed in the final draft. It is just here for convenience of reviewers to know which sections were majorly updated from last review.&lt;br /&gt;
&lt;br /&gt;
* '''Added''' Solution Design for the final implemented design&lt;br /&gt;
* '''Added''' Implemented Solution to show feature additions to Expertiza&lt;br /&gt;
* '''Added''' Feature test cases for Grades controller&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ GitHub API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter3.png&amp;diff=121421</id>
		<title>File:Ooddafter3.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter3.png&amp;diff=121421"/>
		<updated>2018-12-08T23:36:51Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter2.png&amp;diff=121420</id>
		<title>File:Ooddafter2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter2.png&amp;diff=121420"/>
		<updated>2018-12-08T23:35:55Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: uploaded a new version of &amp;amp;quot;File:Ooddafter2.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter2.png&amp;diff=121419</id>
		<title>File:Ooddafter2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter2.png&amp;diff=121419"/>
		<updated>2018-12-08T23:32:58Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121418</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=121418"/>
		<updated>2018-12-08T23:29:53Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Current Scenario */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''Teammate Reviews''' under '''View Scores''' functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give a more realistic view of the work contribution of every team member using external tools like GitHub.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from GitHub. &lt;br /&gt;
&lt;br /&gt;
:1. '''Teammate Reviews''' functionality in the View Scores page gauges teammate views on how much other team members contributed to the project. We need to augment this data with data from external tools like GitHub in order to validate that feedback. New metrics will be appended under each student data under the same functionality.&lt;br /&gt;
:2. '''Github Metrics''' under '''View Submissions''' page should include a bar chart that shows number of commits by the team throughout the assignment timeline. This will help instructors to get a team overview, and aid grading process.&lt;br /&gt;
&lt;br /&gt;
While this data will not have marks associated directly, it will prove useful to the instructor in differentiating the performance of team members and hence awarding marks as per contribution. Overall data for the team, like the number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
Previously, view submission does not show work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
[[File:ooddafter1.png|none|frame|&lt;br /&gt;
At present, view submission shows group assignments are submitted as a single submission and 'view github metric' link shows work contribution per teammate.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows peer review amongst teammates. Currently, however, there is no way to validate and verify these reviews.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on GitHub is a solution, but that is inefficient from instructor's/reviewer's perspective as there are many assignments, submissions, and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
==='''Use Case Diagram'''===&lt;br /&gt;
[[File:UC_1.png|none|frame|1. Use Case diagram of two approaches to append 'GitHub contribution metric' in teammate review. 2. Use Case diagram explaining approach to add new column 'GitHub contribution metric' in 'View submission]]&lt;br /&gt;
&lt;br /&gt;
===='''Use Case Diagram Details'''====&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing, and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able to see the team contribution done by each team member in 'View Submissions' page using graph diagrams, as shown in the figure.&lt;br /&gt;
*Instructor will be able to see the work done by each student in 'Teammate Review Tab' with new metrics table appended at the end, as shown in the figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing our end-point for pulling GitHub data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Solution Design'''==&lt;br /&gt;
&lt;br /&gt;
* The Github metrics that need to be integrated with Expertiza were finalized as below. These metrics are captured on a per-user basis:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# Pull Request Status ( includes code climate and Travis CI Build status)&lt;br /&gt;
*#User Github metrics:&lt;br /&gt;
*## Committer ID&lt;br /&gt;
*## Committer Name&lt;br /&gt;
*## Committer email ID&lt;br /&gt;
	&lt;br /&gt;
* A new link &amp;quot;Github Metrics&amp;quot; is provided under “View Submissions” for an assignment in the instructor view.This link opens a new tab and shows a stacked bar chart for number of commits per user vs submission timeline from assignment creation date to the deadline.&lt;br /&gt;
* In &amp;quot;View Scores&amp;quot; for an assignment in the instructor view, under Teammate Reviews tab, a new table for Github Metrics is added, which shows following Github metrics per user:&lt;br /&gt;
:Student Name/ID, Email ID, lines of code added, lines of code deleted, number of commits&lt;br /&gt;
&lt;br /&gt;
* For GitHub integration, we have used GitHub GraphQL API v4. We have used OAuth gem for authentication purpose.&lt;br /&gt;
&lt;br /&gt;
* We parse the link to PR to get data associated with it. We have also handled projects which do not have PR link, but just a link to the repository.&lt;br /&gt;
&lt;br /&gt;
=='''Implemented Solution'''==&lt;br /&gt;
&lt;br /&gt;
==='''Files Modified'''===&lt;br /&gt;
&lt;br /&gt;
* app/controllers/auth_controller.rb&lt;br /&gt;
* app/controllers/grades_controller.rb&lt;br /&gt;
* app/helpers/grades_helper.rb&lt;br /&gt;
* app/views/assignments/list_submissions.html.erb&lt;br /&gt;
* app/views/grades/_tabbing.html.erb&lt;br /&gt;
* app/views/grades/_teammate_reviews_tab.html.erb&lt;br /&gt;
* app/views/grades/view.html.erb&lt;br /&gt;
* app/views/grades/view_team.html.erb&lt;br /&gt;
* config/application.rb&lt;br /&gt;
* config/initializers/load_config.rb&lt;br /&gt;
* config/initializers/omniauth.rb&lt;br /&gt;
* config/routes.rb&lt;br /&gt;
&lt;br /&gt;
==='''Files Added'''===&lt;br /&gt;
&lt;br /&gt;
* app/views/grades/view_github_metrics.html.erb&lt;br /&gt;
* config/github_auth.yml&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''First Change'''===&lt;br /&gt;
&lt;br /&gt;
* A new table &amp;quot;Github Metrics&amp;quot; is added under Manage-&amp;gt; Assignments -&amp;gt; View Scores -&amp;gt; Teammate Reviews. Below is the screenshot of the implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_1.png|none|frame|The GitHub metrics table shows results for each team member]]&lt;br /&gt;
&lt;br /&gt;
==='''Second Change'''===&lt;br /&gt;
* The second change is in the View Submissions page, where we have added a link &amp;quot;Github Metrics&amp;quot; to a new page.&lt;br /&gt;
[[File:Capture_2.png|none|frame|The GitHub metrics link can be seen below Assign Grade link]]&lt;br /&gt;
&lt;br /&gt;
* The new page appears after clicking on the link &amp;quot;Github metrics&amp;quot;, that shows bar chart for # of commits per day. We have also added other relevant information about Pull Request, such as total commits, lines of code added, lines of code modified, PR merge status, check status.&lt;br /&gt;
&lt;br /&gt;
[[File:Capture_3.png|none|frame|The bar chart]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Change 1: GitHub metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate Reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data per team member based on different GitHub metrics (e.g.  lines of code added/changed/removed etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Change 2: Bar chart for # of commits changed by the overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor (instructor6/password)&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Click on the &amp;quot;Github metrics&amp;quot; link for the team whose metrics you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A new page opens and shows # of commits changed per team member since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''RSpec Tests'''===&lt;br /&gt;
&lt;br /&gt;
* Following feature tests were added to the Grades_Controller_Spec.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  describe &amp;quot;#get_statuses_for_pull_request&amp;quot; do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(Net::HTTP).to receive(:get) {&amp;quot;{\&amp;quot;team\&amp;quot;:\&amp;quot;rails\&amp;quot;,\&amp;quot;players\&amp;quot;:\&amp;quot;36\&amp;quot;}&amp;quot;}&lt;br /&gt;
    end&lt;br /&gt;
     it 'makes a call to the GitHub API to get status of the head commit passed' do&lt;br /&gt;
      expect(controller.get_statuses_for_pull_request('qwerty123')).to eq({&amp;quot;team&amp;quot; =&amp;gt; &amp;quot;rails&amp;quot;, &amp;quot;players&amp;quot; =&amp;gt; &amp;quot;36&amp;quot;})&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  describe '#view_github_metrics' do&lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current participant id and the view action' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(session[&amp;quot;participant_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_submissions&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view_github_metrics, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#view' do  &lt;br /&gt;
    context 'when user hasn\'t logged in to GitHub' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        @params = {id: 900}&lt;br /&gt;
        session[&amp;quot;github_access_token&amp;quot;] = nil&lt;br /&gt;
      end&lt;br /&gt;
       it 'stores the current assignment id and the view action' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(session[&amp;quot;assignment_id&amp;quot;]).to eq(&amp;quot;900&amp;quot;)&lt;br /&gt;
        expect(session[&amp;quot;github_view_type&amp;quot;]).to eq(&amp;quot;view_scores&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
       it 'redirects user to GitHub authorization page' do&lt;br /&gt;
        get :view, @params&lt;br /&gt;
        expect(response).to redirect_to(authorize_github_grades_path)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Change-log for Reviewers'''==&lt;br /&gt;
This section will be removed in the final draft. It is just here for convenience of reviewers to know which sections were majorly updated from last review.&lt;br /&gt;
&lt;br /&gt;
* '''Added''' Solution Design for the final implemented design&lt;br /&gt;
* '''Added''' Implemented Solution to show feature additions to Expertiza&lt;br /&gt;
* '''Added''' Feature test cases for Grades controller&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ GitHub API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter1.png&amp;diff=121417</id>
		<title>File:Ooddafter1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ooddafter1.png&amp;diff=121417"/>
		<updated>2018-12-08T23:27:28Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119938</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119938"/>
		<updated>2018-11-14T02:27:02Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Solution Design'''==&lt;br /&gt;
==='''Design Considerations'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
==='''Plan of action'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
===='''Use case Diagram'''====&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
===='''Use Case Diagram Details'''====&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able see team contribution done by each team member in 'View Submission' page using graph diagrams, as shown in figure.&lt;br /&gt;
*Instructor will be able see work done by each student in 'Teammate Review Tab' with new matric appended at the end, as shown in figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
==='''Detail Design'''===&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtviewscore.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
[[File:Ssdtviewsub.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtfinalss11.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications, as we doing our research around exporting data using API's and displaying.&lt;br /&gt;
As number of commits and number of line changing will keep of changing and stale data does not seem of significant benefit for future analysis, we are concentrating more on fetching current data repositories.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119937</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119937"/>
		<updated>2018-11-14T02:25:38Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Use case Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Solution Design'''==&lt;br /&gt;
==='''Design Considerations'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
==='''Plan of action'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
===='''Use case Diagram'''====&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
===Use Case Diagram Details===&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
'''Primary Sequence:'''&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able see team contribution done by each team member in 'View Submission' page using graph diagrams, as shown in figure.&lt;br /&gt;
*Instructor will be able see work done by each student in 'Teammate Review Tab' with new matric appended at the end, as shown in figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
==='''Detail Design'''===&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtviewscore.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
[[File:Ssdtviewsub.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtfinalss11.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications, as we doing our research around exporting data using API's and displaying.&lt;br /&gt;
As number of commits and number of line changing will keep of changing and stale data does not seem of significant benefit for future analysis, we are concentrating more on fetching current data repositories.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119936</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119936"/>
		<updated>2018-11-14T02:24:18Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Solution Design'''==&lt;br /&gt;
==='''Design Considerations'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
==='''Plan of action'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
===='''Use case Diagram'''====&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able see team contribution done by each team member in 'View Submission' page using graph diagrams, as shown in figure.&lt;br /&gt;
*Instructor will be able see work done by each student in 'Teammate Review Tab' with new matric appended at the end, as shown in figure.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
==='''Detail Design'''===&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtviewscore.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
[[File:Ssdtviewsub.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtfinalss11.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications, as we doing our research around exporting data using API's and displaying.&lt;br /&gt;
As number of commits and number of line changing will keep of changing and stale data does not seem of significant benefit for future analysis, we are concentrating more on fetching current data repositories.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119935</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119935"/>
		<updated>2018-11-14T02:20:30Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Use case Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Solution Design'''==&lt;br /&gt;
==='''Design Considerations'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
==='''Plan of action'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
===='''Use case Diagram'''====&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
*The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able see team contribution done by each team member in 'View Submission' page using graph diagrams, as shown in figure.&lt;br /&gt;
*Instructor will be able see work done by each student in 'Teammate Review Tab' with new matric appended at the end, as shown in figure.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
==='''Detail Design'''===&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtviewscore.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
[[File:Ssdtviewsub.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtfinalss11.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119934</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119934"/>
		<updated>2018-11-14T02:20:08Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Use case Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Solution Design'''==&lt;br /&gt;
==='''Design Considerations'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
==='''Plan of action'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
===='''Use case Diagram'''====&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actors:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
*Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
'''Database:'''&lt;br /&gt;
&lt;br /&gt;
:The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Pre Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
*The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
*The student should login.&lt;br /&gt;
&lt;br /&gt;
*The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
*The student should submit teammate-reviews.&lt;br /&gt;
&lt;br /&gt;
'''Post Conditions:'''&lt;br /&gt;
&lt;br /&gt;
*Instructor will be able see team contribution done by each team member in 'View Submission' page using graph diagrams, as shown in figure.&lt;br /&gt;
*Instructor will be able see work done by each student in 'Teammate Review Tab' with new matric appended at the end, as shown in figure.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
==='''Detail Design'''===&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtviewscore.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
[[File:Ssdtviewsub.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtfinalss11.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119933</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119933"/>
		<updated>2018-11-14T02:13:23Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Solution Design'''==&lt;br /&gt;
==='''Design Considerations'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
==='''Plan of action'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
===='''Use case Diagram'''====&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Actors:&lt;br /&gt;
&lt;br /&gt;
:Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
:Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
Database:&lt;br /&gt;
&lt;br /&gt;
:The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
All the other use cases are implemented except “View Scores with self-review column and composite score”&lt;br /&gt;
&lt;br /&gt;
Use Case: View score with self-review column and composite score&lt;br /&gt;
&lt;br /&gt;
Pre Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
2.The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
1.The student should login.&lt;br /&gt;
&lt;br /&gt;
2.The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
3.The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
4.The student should submit the self-review.&lt;br /&gt;
&lt;br /&gt;
5.The student should choose your scores to view the score.&lt;br /&gt;
&lt;br /&gt;
6.The student should be able to see the peer-review score with the self-review scores and composite score. &lt;br /&gt;
&lt;br /&gt;
Post Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The self-review and composite score will be visible on the page.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
==='''Detail Design'''===&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtviewscore.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
[[File:Ssdtviewsub.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtfinalss11.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119932</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119932"/>
		<updated>2018-11-14T02:11:17Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed Solution Design'''==&lt;br /&gt;
==='''Design Considerations'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
==='''Plan of action'''===&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
===='''Use case Diagram'''====&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|&lt;br /&gt;
== Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==&lt;br /&gt;
]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|&lt;br /&gt;
== Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission' ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Actors:&lt;br /&gt;
&lt;br /&gt;
:Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
:Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
Database:&lt;br /&gt;
&lt;br /&gt;
:The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
All the other use cases are implemented except “View Scores with self-review column and composite score”&lt;br /&gt;
&lt;br /&gt;
Use Case: View score with self-review column and composite score&lt;br /&gt;
&lt;br /&gt;
Pre Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
2.The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
1.The student should login.&lt;br /&gt;
&lt;br /&gt;
2.The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
3.The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
4.The student should submit the self-review.&lt;br /&gt;
&lt;br /&gt;
5.The student should choose your scores to view the score.&lt;br /&gt;
&lt;br /&gt;
6.The student should be able to see the peer-review score with the self-review scores and composite score. &lt;br /&gt;
&lt;br /&gt;
Post Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The self-review and composite score will be visible on the page.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
==='''Design Principles'''===&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
==='''Detail Design'''===&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtviewscore.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
[[File:Ssdtviewsub.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtfinalss11.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119918</id>
		<title>CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018-_Project_E1858._Github_metrics_integration&amp;diff=119918"/>
		<updated>2018-11-14T02:00:23Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: Created page with &amp;quot;=='''Introduction'''==  ===Problem Statement===  Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment. Purpo...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
== At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
== Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Design Considerations'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
=='''Plan of action'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
=='''Use case Diagram'''==&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|&lt;br /&gt;
== Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==&lt;br /&gt;
]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|&lt;br /&gt;
== Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission' ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Actors:&lt;br /&gt;
&lt;br /&gt;
:Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
:Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
Database:&lt;br /&gt;
&lt;br /&gt;
:The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
All the other use cases are implemented except “View Scores with self-review column and composite score”&lt;br /&gt;
&lt;br /&gt;
Use Case: View score with self-review column and composite score&lt;br /&gt;
&lt;br /&gt;
Pre Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
2.The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
1.The student should login.&lt;br /&gt;
&lt;br /&gt;
2.The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
3.The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
4.The student should submit the self-review.&lt;br /&gt;
&lt;br /&gt;
5.The student should choose your scores to view the score.&lt;br /&gt;
&lt;br /&gt;
6.The student should be able to see the peer-review score with the self-review scores and composite score. &lt;br /&gt;
&lt;br /&gt;
Post Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The self-review and composite score will be visible on the page.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
=='''Design Principles'''==&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed solutions'''==&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtviewscore.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
[[File:Ssdtviewsub.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtfinalss11.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018&amp;diff=119917</id>
		<title>CSC/ECE 517 Fall 2018</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2018&amp;diff=119917"/>
		<updated>2018-11-14T01:59:59Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Fall 2018- Project E1846. OSS Project Navy: Character Issues]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2018/OSS E1848 Write unit tests for assignment team.rb]]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/E1839_Review_Requirements_and_Thresholds CSC/ECE 517 Fall 2018 E1839 Review Requirements and Thresholds]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/E1848_Write_unit_tests_for_assignment_team CSC/ECE 517 Fall 2018 E1848 Write unit tests for assignment_team]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/E1835_Refactor_delayed_mailer_and_scheduled_task CSC/ECE 517 Fall 2018 E1835_Refactor_delayed_mailer_and_scheduled_task]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/E1829_OSS_project_Duke_Blue_Fix_import_glitches CSC/ECE 517 Fall 2018 E1829 OSS project Duke Blue: Fix import glitches]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1853_Write_unit_tests_for_menu.rb CSC/ECE 517 Fall 2018 E1853 Write unit tests for menu.rb]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/E1853_write_unit_tests_for_menu CSC/ECE517 Fall 2018 E1853 Write Unit Tests For menu.rb]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018_-_Project_E1852_Write_unit_tests_for_participant.rb CSC/ECE 517 Fall 2018 E1852 Write unit tests for participant.rb]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/E1844_Issues_related_to_names CSC/ECE 517 Fall 2018 E1844 Issues related to names]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/User_talk:Rshakya CSC/ECE 517 Fall 2018/E1852 Unit Test for Participant Model]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/E1850_Write_unit_tests_for_review_response_map CSC/ECE 517 Fall 2018 Write unit tests for review-response_map.rb]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1849_Write_Unit_Tests_for_vm_question_response.rb CSC/ECE 517 Fall 2018/E1849 Write Unit Tests for vm_question_response.rb]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1866_Expertiza_Internationalization CSC/ECE 517 Fall 2018/E1866 Expertiza Internationalization]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1879_Student_Generated_Questions_Added_To_Rubric CSC/ECE 517 Fall 2018/E1879 Student Generated Questions Added To Rubric]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1856_Allow_reviewers_to_bid_on_what_to_review CSC/ECE 517 Fall 2018/E1856 Allow]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1876_Completion/Progress_view CSC/ECE 517 Fall 2018 E1876_Completion/Progress_view]&lt;br /&gt;
* [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions CSC/ECE 517 Fall 2018/E1872 Track Time Students Look At Other Submissions]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2018- Project E1865. Conflict Notification]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2018- Project E1861. Improving search facility in Expertiza]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2018- Project E1858. Github metrics integration]]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119914</id>
		<title>E1858 Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119914"/>
		<updated>2018-11-14T01:53:54Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Proposed solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
== At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
== Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Design Considerations'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
=='''Plan of action'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
=='''Use case Diagram'''==&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|&lt;br /&gt;
== Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==&lt;br /&gt;
]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|&lt;br /&gt;
== Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission' ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Actors:&lt;br /&gt;
&lt;br /&gt;
:Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
:Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
Database:&lt;br /&gt;
&lt;br /&gt;
:The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
All the other use cases are implemented except “View Scores with self-review column and composite score”&lt;br /&gt;
&lt;br /&gt;
Use Case: View score with self-review column and composite score&lt;br /&gt;
&lt;br /&gt;
Pre Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
2.The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
1.The student should login.&lt;br /&gt;
&lt;br /&gt;
2.The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
3.The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
4.The student should submit the self-review.&lt;br /&gt;
&lt;br /&gt;
5.The student should choose your scores to view the score.&lt;br /&gt;
&lt;br /&gt;
6.The student should be able to see the peer-review score with the self-review scores and composite score. &lt;br /&gt;
&lt;br /&gt;
Post Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The self-review and composite score will be visible on the page.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
=='''Design Principles'''==&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed solutions'''==&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtviewscore.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
[[File:Ssdtviewsub.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtfinalss11.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtviewscore.png&amp;diff=119912</id>
		<title>File:Ssdtviewscore.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtviewscore.png&amp;diff=119912"/>
		<updated>2018-11-14T01:52:38Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119911</id>
		<title>E1858 Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119911"/>
		<updated>2018-11-14T01:52:20Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Proposed solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
== At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
== Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Design Considerations'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
=='''Plan of action'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
=='''Use case Diagram'''==&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|&lt;br /&gt;
== Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==&lt;br /&gt;
]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|&lt;br /&gt;
== Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission' ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Actors:&lt;br /&gt;
&lt;br /&gt;
:Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
:Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
Database:&lt;br /&gt;
&lt;br /&gt;
:The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
All the other use cases are implemented except “View Scores with self-review column and composite score”&lt;br /&gt;
&lt;br /&gt;
Use Case: View score with self-review column and composite score&lt;br /&gt;
&lt;br /&gt;
Pre Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
2.The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
1.The student should login.&lt;br /&gt;
&lt;br /&gt;
2.The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
3.The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
4.The student should submit the self-review.&lt;br /&gt;
&lt;br /&gt;
5.The student should choose your scores to view the score.&lt;br /&gt;
&lt;br /&gt;
6.The student should be able to see the peer-review score with the self-review scores and composite score. &lt;br /&gt;
&lt;br /&gt;
Post Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The self-review and composite score will be visible on the page.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
=='''Design Principles'''==&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed solutions'''==&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[Ssdtviewscore.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
[[File:Ssdtviewsub.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtfinalss11.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119909</id>
		<title>E1858 Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119909"/>
		<updated>2018-11-14T01:47:58Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Proposed solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
== At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
== Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Design Considerations'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
=='''Plan of action'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
=='''Use case Diagram'''==&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|&lt;br /&gt;
== Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==&lt;br /&gt;
]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|&lt;br /&gt;
== Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission' ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Actors:&lt;br /&gt;
&lt;br /&gt;
:Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
:Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
Database:&lt;br /&gt;
&lt;br /&gt;
:The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
All the other use cases are implemented except “View Scores with self-review column and composite score”&lt;br /&gt;
&lt;br /&gt;
Use Case: View score with self-review column and composite score&lt;br /&gt;
&lt;br /&gt;
Pre Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
2.The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
1.The student should login.&lt;br /&gt;
&lt;br /&gt;
2.The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
3.The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
4.The student should submit the self-review.&lt;br /&gt;
&lt;br /&gt;
5.The student should choose your scores to view the score.&lt;br /&gt;
&lt;br /&gt;
6.The student should be able to see the peer-review score with the self-review scores and composite score. &lt;br /&gt;
&lt;br /&gt;
Post Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The self-review and composite score will be visible on the page.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
=='''Design Principles'''==&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed solutions'''==&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
[[File:Ssdtviewsub.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtfinalss11.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119907</id>
		<title>E1858 Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119907"/>
		<updated>2018-11-14T01:46:55Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Proposed solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
== At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
== Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Design Considerations'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
=='''Plan of action'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
=='''Use case Diagram'''==&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|&lt;br /&gt;
== Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==&lt;br /&gt;
]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|&lt;br /&gt;
== Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission' ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Actors:&lt;br /&gt;
&lt;br /&gt;
:Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
:Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
Database:&lt;br /&gt;
&lt;br /&gt;
:The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
All the other use cases are implemented except “View Scores with self-review column and composite score”&lt;br /&gt;
&lt;br /&gt;
Use Case: View score with self-review column and composite score&lt;br /&gt;
&lt;br /&gt;
Pre Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
2.The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
1.The student should login.&lt;br /&gt;
&lt;br /&gt;
2.The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
3.The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
4.The student should submit the self-review.&lt;br /&gt;
&lt;br /&gt;
5.The student should choose your scores to view the score.&lt;br /&gt;
&lt;br /&gt;
6.The student should be able to see the peer-review score with the self-review scores and composite score. &lt;br /&gt;
&lt;br /&gt;
Post Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The self-review and composite score will be visible on the page.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
=='''Design Principles'''==&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed solutions'''==&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtviewsub.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtfinalss11.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtfinalss11.png&amp;diff=119906</id>
		<title>File:Ssdtfinalss11.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtfinalss11.png&amp;diff=119906"/>
		<updated>2018-11-14T01:45:58Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtviewsub.png&amp;diff=119905</id>
		<title>File:Ssdtviewsub.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtviewsub.png&amp;diff=119905"/>
		<updated>2018-11-14T01:45:44Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119903</id>
		<title>E1858 Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119903"/>
		<updated>2018-11-14T01:45:14Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Proposed solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
== At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
== Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Design Considerations'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
=='''Plan of action'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
=='''Use case Diagram'''==&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|&lt;br /&gt;
== Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==&lt;br /&gt;
]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|&lt;br /&gt;
== Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission' ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Actors:&lt;br /&gt;
&lt;br /&gt;
:Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
:Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
Database:&lt;br /&gt;
&lt;br /&gt;
:The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
All the other use cases are implemented except “View Scores with self-review column and composite score”&lt;br /&gt;
&lt;br /&gt;
Use Case: View score with self-review column and composite score&lt;br /&gt;
&lt;br /&gt;
Pre Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
2.The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
1.The student should login.&lt;br /&gt;
&lt;br /&gt;
2.The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
3.The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
4.The student should submit the self-review.&lt;br /&gt;
&lt;br /&gt;
5.The student should choose your scores to view the score.&lt;br /&gt;
&lt;br /&gt;
6.The student should be able to see the peer-review score with the self-review scores and composite score. &lt;br /&gt;
&lt;br /&gt;
Post Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The self-review and composite score will be visible on the page.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
=='''Design Principles'''==&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed solutions'''==&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtfinalss11.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtviewsub.png|none|frame|caption]]&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119899</id>
		<title>E1858 Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119899"/>
		<updated>2018-11-14T01:38:01Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Use case Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
== At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
== Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Design Considerations'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
=='''Plan of action'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
=='''Use case Diagram'''==&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|frame|&lt;br /&gt;
== Use Case diagram of two approaches to append 'Github contribution metric' in teammate review. ==&lt;br /&gt;
]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|frame|&lt;br /&gt;
== Use Case diagram explaining approach to add new column 'Github contribution metric' in 'View submission' ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Actors:&lt;br /&gt;
&lt;br /&gt;
:Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
:Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
Database:&lt;br /&gt;
&lt;br /&gt;
:The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
All the other use cases are implemented except “View Scores with self-review column and composite score”&lt;br /&gt;
&lt;br /&gt;
Use Case: View score with self-review column and composite score&lt;br /&gt;
&lt;br /&gt;
Pre Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
2.The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
1.The student should login.&lt;br /&gt;
&lt;br /&gt;
2.The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
3.The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
4.The student should submit the self-review.&lt;br /&gt;
&lt;br /&gt;
5.The student should choose your scores to view the score.&lt;br /&gt;
&lt;br /&gt;
6.The student should be able to see the peer-review score with the self-review scores and composite score. &lt;br /&gt;
&lt;br /&gt;
Post Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The self-review and composite score will be visible on the page.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
=='''Design Principles'''==&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed solutions'''==&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:x.png]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
&lt;br /&gt;
[[File:x.png]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecasemerge.png&amp;diff=119896</id>
		<title>File:Ssdtusecasemerge.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecasemerge.png&amp;diff=119896"/>
		<updated>2018-11-14T01:32:21Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119895</id>
		<title>E1858 Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119895"/>
		<updated>2018-11-14T01:31:50Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Use case Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''View Submissions''' and '''Teammate Reviews''' (under View Scores) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Current Scenario'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
== At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
== Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Design Considerations'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
=='''Plan of action'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
=='''Use case Diagram'''==&lt;br /&gt;
[[File:Ssdtusecasemerge.png|none|caption]]&lt;br /&gt;
[[File:Ssdtusecase323.png|none|caption]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Actors:&lt;br /&gt;
&lt;br /&gt;
:Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
:Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
Database:&lt;br /&gt;
&lt;br /&gt;
:The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
All the other use cases are implemented except “View Scores with self-review column and composite score”&lt;br /&gt;
&lt;br /&gt;
Use Case: View score with self-review column and composite score&lt;br /&gt;
&lt;br /&gt;
Pre Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
2.The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
1.The student should login.&lt;br /&gt;
&lt;br /&gt;
2.The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
3.The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
4.The student should submit the self-review.&lt;br /&gt;
&lt;br /&gt;
5.The student should choose your scores to view the score.&lt;br /&gt;
&lt;br /&gt;
6.The student should be able to see the peer-review score with the self-review scores and composite score. &lt;br /&gt;
&lt;br /&gt;
Post Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The self-review and composite score will be visible on the page.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
=='''Design Principles'''==&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed solutions'''==&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:x.png]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
&lt;br /&gt;
[[File:x.png]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
'''Subtask 1: Github metrics in teammate reviews'''&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 1:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Github metrics&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) View data based on different Github metrics (e.g.  lines of code added/changed/removed etc.) for each teammate&lt;br /&gt;
&lt;br /&gt;
'''Test plan for proposed solution 2:'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View scores&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team for which you wish to view scores&lt;br /&gt;
&lt;br /&gt;
5) Go to &amp;quot;Teammate reviews&amp;quot; tab&lt;br /&gt;
&lt;br /&gt;
6) Select the student for whom you wish to view teammate review&lt;br /&gt;
&lt;br /&gt;
7) Below the usual criteria, view criteria for different Github metrics (e.g.  lines of code added/changed/removed etc.) portrayed in different color scheme (light blue)&lt;br /&gt;
&lt;br /&gt;
'''Subtask 2: Line chart for # of lines changed by overall team'''&lt;br /&gt;
&lt;br /&gt;
1) Log in as an instructor&lt;br /&gt;
&lt;br /&gt;
2) Navigate to assignments through Manage --&amp;gt; Assignments&lt;br /&gt;
&lt;br /&gt;
3) Select &amp;quot;View submissions&amp;quot; icon for the assignment of your choice&lt;br /&gt;
&lt;br /&gt;
4) Select the team whose submissions you wish to view&lt;br /&gt;
&lt;br /&gt;
5) A newly added Github metrics column is added to show # of lines changed since the start of the assignment&lt;br /&gt;
&lt;br /&gt;
=='''References'''==&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader E1815:_Improvements_to_review_grader]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1179 Expertiza_PR_1179]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=HHdta64VHcY Expertiza_PR_1179_Video]&lt;br /&gt;
&lt;br /&gt;
[https://developer.github.com/v3/ Github API documentation]&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtfinalss.png&amp;diff=119894</id>
		<title>File:Ssdtfinalss.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtfinalss.png&amp;diff=119894"/>
		<updated>2018-11-14T01:26:10Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtfinalss1.png&amp;diff=119893</id>
		<title>File:Ssdtfinalss1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtfinalss1.png&amp;diff=119893"/>
		<updated>2018-11-14T01:25:56Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase323.png&amp;diff=119650</id>
		<title>File:Ssdtusecase323.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase323.png&amp;diff=119650"/>
		<updated>2018-11-13T06:27:12Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase223.png&amp;diff=119649</id>
		<title>File:Ssdtusecase223.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase223.png&amp;diff=119649"/>
		<updated>2018-11-13T06:26:58Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase123.png&amp;diff=119648</id>
		<title>File:Ssdtusecase123.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase123.png&amp;diff=119648"/>
		<updated>2018-11-13T06:26:42Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119639</id>
		<title>E1858 Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119639"/>
		<updated>2018-11-13T06:21:32Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Use case Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''view submission''' and '''teammate review''' (under view score) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Overall Description==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
== At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
== Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Design Considerations'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
=='''Plan of action'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Use case Diagram'''==&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:Ssdtusecase12.png|none|caption&lt;br /&gt;
File:Ssdtusecase22.png|none|caption&lt;br /&gt;
File:Ssdtusecase32.png|none|caption&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Actors:&lt;br /&gt;
&lt;br /&gt;
:Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
:Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
Database:&lt;br /&gt;
&lt;br /&gt;
:The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
All the other use cases are implemented except “View Scores with self-review column and composite score”&lt;br /&gt;
&lt;br /&gt;
Use Case: View score with self-review column and composite score&lt;br /&gt;
&lt;br /&gt;
Pre Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
2.The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
1.The student should login.&lt;br /&gt;
&lt;br /&gt;
2.The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
3.The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
4.The student should submit the self-review.&lt;br /&gt;
&lt;br /&gt;
5.The student should choose your scores to view the score.&lt;br /&gt;
&lt;br /&gt;
6.The student should be able to see the peer-review score with the self-review scores and composite score. &lt;br /&gt;
&lt;br /&gt;
Post Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The self-review and composite score will be visible on the page.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
=='''Design Principles'''==&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed solutions'''==&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:x.png]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
&lt;br /&gt;
[[File:x.png]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan==&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|Test case ID&lt;br /&gt;
|Test Objective&lt;br /&gt;
|PreConditions&lt;br /&gt;
|Steps&lt;br /&gt;
|Test Data&lt;br /&gt;
|Expected Result&lt;br /&gt;
|Post Conditions&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|E1799_Test_Case_1&lt;br /&gt;
|Successfully displaying self review scores in the heat map view&lt;br /&gt;
|1. The student should do the self review.&lt;br /&gt;
2. The scores of the self review should be present in the database.&lt;br /&gt;
|1. Login to the Expertiza Application.&lt;br /&gt;
2. Submit the assignment created by the instructor by browsing it.&lt;br /&gt;
&lt;br /&gt;
3. Choose the self review option and complete the self review.&lt;br /&gt;
&lt;br /&gt;
4. Go to view scores option.&lt;br /&gt;
|Submit the relevant assignment before doing the self review.&lt;br /&gt;
|The self review column is displayed together with the other peer reviews in the end.&lt;br /&gt;
|The student is able to see the self review column.&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|E1799_Test_Case_2&lt;br /&gt;
|Successfully calculating the proper composite score.&lt;br /&gt;
|1. The student should do the self review.&lt;br /&gt;
2. The score of the self review should be present in the database.&lt;br /&gt;
&lt;br /&gt;
3. The function is implemented to calculate the composite score using average of the peer reviews and the self review.&lt;br /&gt;
|1. Login to the Expertiza Application.&lt;br /&gt;
2. Submit the assignment created by the instructor by browsing it.&lt;br /&gt;
&lt;br /&gt;
3. Choose the self review option and complete the self review.&lt;br /&gt;
&lt;br /&gt;
4. Go to view scores option.&lt;br /&gt;
|Submit the relevant assignment before doing the self review.&lt;br /&gt;
|The composite score is returned by the method.&lt;br /&gt;
|The method is able to return the expected composite score.&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|E1799_Test_Case_3&lt;br /&gt;
|Successfully displaying of composite score in the heat map view.&lt;br /&gt;
|1. The student should do the self review.&lt;br /&gt;
2. The scores of the self review should be present in the database.&lt;br /&gt;
|1. Login to the Expertiza Application.&lt;br /&gt;
2. Submit the assignment created by the instructor by browsing it.&lt;br /&gt;
&lt;br /&gt;
3. Choose the self review option and complete the self review.&lt;br /&gt;
&lt;br /&gt;
4. Go to view scores option.&lt;br /&gt;
|Submit the relevant assignment before doing the self review.&lt;br /&gt;
|The composite score is displayed in the heat map view.&lt;br /&gt;
|The student is able to see the composite score.&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|E1799_Test_Case_4&lt;br /&gt;
|Successfully displaying of composite score in alternate view.&lt;br /&gt;
|1. The student should do the self review.&lt;br /&gt;
2. The scores of the self review should be present in the database.&lt;br /&gt;
|1. Login to the Expertiza Application.&lt;br /&gt;
2. Submit the assignment created by the instructor by browsing it.&lt;br /&gt;
&lt;br /&gt;
3. Choose the self review option and complete the self review.&lt;br /&gt;
&lt;br /&gt;
4. Go to alternate scores option.&lt;br /&gt;
|Submit the relevant assignment before doing the self review.&lt;br /&gt;
|The composite score is displayed in the alternate scores view.&lt;br /&gt;
|The student is able to see the composite score.&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=='''References==&lt;br /&gt;
&lt;br /&gt;
http://wiki.expertiza.ncsu.edu/index.php/Main_Page&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119637</id>
		<title>E1858 Github metrics integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1858_Github_metrics_integration&amp;diff=119637"/>
		<updated>2018-11-13T06:17:59Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: /* Use case Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction'''==&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
Expertiza provides '''view submission''' and '''teammate review''' (under view score) functionality for each assignment.&lt;br /&gt;
Purpose of this project is to augment existing assignment submissions with data that can give more realistic view on work contribution of every team member using external tools like Github.&lt;br /&gt;
This external data may include: number of commits, number of lines of code modified, number of lines added, number of lines deleted from each group’s submitted repository link from Github. &lt;br /&gt;
&lt;br /&gt;
:1. '''View submission''' provides list of submission of all the teams for that particular assignment. We can add new column to show work distribution among the whole team from external tools like Github. This new column will provide work distribution on whole team using bar graphs and other statistics.&lt;br /&gt;
&lt;br /&gt;
:2. '''Teammate Reviews''' functionality gauges team mates views on how much each team member contributed, but we would like to augment this data with data from external tools like Github. New metrics will be appended under each student data.&lt;br /&gt;
for example,  &lt;br /&gt;
This information should prove useful for differentiating the performance of team members for grading purposes. Overall data for the team, like number of committers and number of commits may also help instructors to predict which projects are likely to be merged.&lt;br /&gt;
&lt;br /&gt;
=='''Overall Description==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Current Scenario===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_22.png|none|frame|&lt;br /&gt;
== At present, group assignments are submitted as a single submission that shows work done as a whole team. This does not show work contribution done by each teammate. ==&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdt_123.png|none|frame|&lt;br /&gt;
== Teammate review shows views of each teammate on every other teammates work. That might leads to discrepancy while validating the reviews. ==&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking commits performed by each team member on Github is one of the solution, but that does not seems efficient from instructor/reviews perspective considering huge number of assignments, number of submissions and tight deadlines.&lt;br /&gt;
&lt;br /&gt;
=='''Design Considerations'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to determine what metrics we are looking for exactly. These are what the requirements document suggests:&lt;br /&gt;
*# Total number of commits.&lt;br /&gt;
*# Number of files changed.&lt;br /&gt;
*# Lines of Code added&lt;br /&gt;
*# Lines of code modified.&lt;br /&gt;
*# Lines of code deleted.&lt;br /&gt;
*# LOCs that survived until final submission - (exclude from MVP due to complexity and lower priority).&lt;br /&gt;
&lt;br /&gt;
:We are assuming these metrics are needed on a per-user basis.&lt;br /&gt;
	&lt;br /&gt;
:The requirement document expects a view to be created for viewing the metrics under a new tab “Github Metrics” under “View Submissions” in the instructor view.&lt;br /&gt;
:A line chart of number of lines vs time needs to be included in the view.&lt;br /&gt;
&lt;br /&gt;
* The next thing is to narrow down what hosting service for version control we will use. For now, the plan is to only support Github integration due to it popularity, ease-of-use and API documentation. Future projects could add in support for Gitlab and others, though it is far easier to just require that all students use Github.&lt;br /&gt;
*# The main impact of this change will be that all submission repositories need to be made public as we need access to pull in the data.&lt;br /&gt;
*# We also need to consider whether to ask students for github repo link separately(changes to views) or to parse all the uploaded links and determine the correct one (extra logic, students uploading multiple links or not giving links at all).&lt;br /&gt;
&lt;br /&gt;
* An important question is whether we need to store metric information in our own db at all. &lt;br /&gt;
*# An older investigation came up with this schema, but this is likely to cause issues with stale information and will be difficult to maintain.&lt;br /&gt;
*# Having a db is redundant as every time a user wants to see the metrics, we would need to sync the db with Github and then show the results. So we end up hitting Github api anyway.&lt;br /&gt;
*# An alternative to the above approach is to take snapshots of metrics and store them in the db right on the submission deadline of projects. This will allow for fairer grading by making sure we pull in data at the correct moment. Unfortunately, doing this for so many projects could put a lot of load on server. Also, for open source projects this would mean that we don’t have the latest data to work with(people will keep committing past deadline). Thus, this approach might be good for grading purposes but doesn’t help with determining the current status of a project.&lt;br /&gt;
*# All that said, we might need to maintain some meta-data in our db- investigation pending.&lt;br /&gt;
&lt;br /&gt;
* We also need to consider if we need to account for different branches. The initial plan is to only consider the master branch.&lt;br /&gt;
&lt;br /&gt;
* A suggestion was also to make sure that there isn’t a lot of padding in the tables we show.&lt;br /&gt;
&lt;br /&gt;
* With respect to showing Github metrics in the View scores page, it will be very difficult to map Expertiza users and their names to public Github profiles as students may use different name. So instead of appending Github data to Teammate reivews table, it would be easier to just add a new tab called &amp;quot;Github Metrics&amp;quot; and show the results there. &lt;br /&gt;
&lt;br /&gt;
* The instructors will need to spell out exact guidelines for committing to the projects repos(like everyone should commit their own code, keep the master as PR branch, commit regularly, be mindful of squashing too many commits for one user), so that we can have proper and correct data and, also so that students can’t weasel their way out later claiming they worked but forgot or didn’t know.&lt;br /&gt;
&lt;br /&gt;
=='''Plan of action'''==&lt;br /&gt;
&lt;br /&gt;
* The first thing is to investigate if there are any rails gems(Octokit/Unicorn maybe?) to get Github data and if we are allowed to use them. The idea is to always get the latest data from Github and show it to the user. For grading purposes, we could alternate a view between latest data and data till submission deadlines.&lt;br /&gt;
* If there are no such gems or if we aren’t allowed to use gems, we need to write to mock endpoints to understand out how to get data from github. There is [https://developer.github.com/v3/ ample] documentation for this. The github api returns JSON which can be easily parsed.&lt;br /&gt;
* We then need to figure out how to load this data(AJAX? or gem?) when instructor selects “Github Rubrics”(if we do this) or &amp;quot;Teammate Review&amp;quot; in the View Scores page. Similar data needs to be loaded in the View Submissions page.&lt;br /&gt;
* We will need a mock up view to display this data in a table.&lt;br /&gt;
* We then implement the view. For charting, suggestion is to use a previous project for charting- [https://www.youtube.com/watch?v=HHdta64VHcY 1] [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2018_E1815:_Improvements_to_review_grader 2] [https://github.com/expertiza/expertiza/pull/1179 3].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Use case Diagram'''==&lt;br /&gt;
&lt;br /&gt;
[[File:Ssdtusecase12.png|none|caption]]&lt;br /&gt;
[[File:Ssdtusecase22.png|none|caption]]&lt;br /&gt;
[[File:Ssdtusecase32.png|none|caption]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Actors:&lt;br /&gt;
&lt;br /&gt;
:Instructor: This actor is responsible for creating assignments and adding students to the assignment. &lt;br /&gt;
&lt;br /&gt;
:Student: This actor is responsible for submitting, self-reviewing and viewing the scores.&lt;br /&gt;
&lt;br /&gt;
Database:&lt;br /&gt;
&lt;br /&gt;
:The database where all the data of Expertiza is getting stored.&lt;br /&gt;
&lt;br /&gt;
All the other use cases are implemented except “View Scores with self-review column and composite score”&lt;br /&gt;
&lt;br /&gt;
Use Case: View score with self-review column and composite score&lt;br /&gt;
&lt;br /&gt;
Pre Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The Student should submit the assignment and self-review.&lt;br /&gt;
&lt;br /&gt;
2.The other students should submit the reviews of the work submitted.&lt;br /&gt;
&lt;br /&gt;
Primary Sequence:&lt;br /&gt;
&lt;br /&gt;
1.The student should login.&lt;br /&gt;
&lt;br /&gt;
2.The student should browse and upload the assignment.&lt;br /&gt;
&lt;br /&gt;
3.The student should submit the assignment.&lt;br /&gt;
&lt;br /&gt;
4.The student should submit the self-review.&lt;br /&gt;
&lt;br /&gt;
5.The student should choose your scores to view the score.&lt;br /&gt;
&lt;br /&gt;
6.The student should be able to see the peer-review score with the self-review scores and composite score. &lt;br /&gt;
&lt;br /&gt;
Post Conditions:&lt;br /&gt;
&lt;br /&gt;
1.The self-review and composite score will be visible on the page.&lt;br /&gt;
&lt;br /&gt;
=='''Database Design==&lt;br /&gt;
&lt;br /&gt;
As of now, we do not have plans for database modifications.&lt;br /&gt;
&lt;br /&gt;
=='''Design Principles'''==&lt;br /&gt;
&lt;br /&gt;
* MVC – The project is implemented in Ruby on Rails that uses MVC architecture.  It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively). We intend to follow the same when implementing out end-point for pulling Github data.&lt;br /&gt;
&lt;br /&gt;
* Dry Principle – We are trying to reuse the existing functionalities in Expertiza,thus avoiding code duplication.  Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.&lt;br /&gt;
&lt;br /&gt;
=='''Proposed solutions'''==&lt;br /&gt;
* The first change would would be under the &amp;quot;Teammate Review&amp;quot; tab in the &amp;quot;View Scores&amp;quot; page. We either add new rows to the table, one for each of the Github metrics, and display the results for every student in the project as mocked up here: &lt;br /&gt;
&lt;br /&gt;
[[File:x.png]]&lt;br /&gt;
&lt;br /&gt;
Or we might add a new tab called &amp;quot;Github Metrics&amp;quot; in the View scores page and then show the metrics and the results in tabular format as mocked up:&lt;br /&gt;
&lt;br /&gt;
[[File:x.png]]&lt;br /&gt;
&lt;br /&gt;
* The second change is in the View Submissions page, where we intend to add a new column to the table that shows a chart per assignment team. This chart will show proportion of contributions per team member.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation==&lt;br /&gt;
&lt;br /&gt;
The last column has the self review scores. The composite score is calculated and is displayed at the bottom of the table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:proper view.png]]&lt;br /&gt;
&lt;br /&gt;
The composite score is displayed beside the average peer review score.&lt;br /&gt;
&lt;br /&gt;
[[File:alternate_view.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan==&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|Test case ID&lt;br /&gt;
|Test Objective&lt;br /&gt;
|PreConditions&lt;br /&gt;
|Steps&lt;br /&gt;
|Test Data&lt;br /&gt;
|Expected Result&lt;br /&gt;
|Post Conditions&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|E1799_Test_Case_1&lt;br /&gt;
|Successfully displaying self review scores in the heat map view&lt;br /&gt;
|1. The student should do the self review.&lt;br /&gt;
2. The scores of the self review should be present in the database.&lt;br /&gt;
|1. Login to the Expertiza Application.&lt;br /&gt;
2. Submit the assignment created by the instructor by browsing it.&lt;br /&gt;
&lt;br /&gt;
3. Choose the self review option and complete the self review.&lt;br /&gt;
&lt;br /&gt;
4. Go to view scores option.&lt;br /&gt;
|Submit the relevant assignment before doing the self review.&lt;br /&gt;
|The self review column is displayed together with the other peer reviews in the end.&lt;br /&gt;
|The student is able to see the self review column.&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|E1799_Test_Case_2&lt;br /&gt;
|Successfully calculating the proper composite score.&lt;br /&gt;
|1. The student should do the self review.&lt;br /&gt;
2. The score of the self review should be present in the database.&lt;br /&gt;
&lt;br /&gt;
3. The function is implemented to calculate the composite score using average of the peer reviews and the self review.&lt;br /&gt;
|1. Login to the Expertiza Application.&lt;br /&gt;
2. Submit the assignment created by the instructor by browsing it.&lt;br /&gt;
&lt;br /&gt;
3. Choose the self review option and complete the self review.&lt;br /&gt;
&lt;br /&gt;
4. Go to view scores option.&lt;br /&gt;
|Submit the relevant assignment before doing the self review.&lt;br /&gt;
|The composite score is returned by the method.&lt;br /&gt;
|The method is able to return the expected composite score.&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|E1799_Test_Case_3&lt;br /&gt;
|Successfully displaying of composite score in the heat map view.&lt;br /&gt;
|1. The student should do the self review.&lt;br /&gt;
2. The scores of the self review should be present in the database.&lt;br /&gt;
|1. Login to the Expertiza Application.&lt;br /&gt;
2. Submit the assignment created by the instructor by browsing it.&lt;br /&gt;
&lt;br /&gt;
3. Choose the self review option and complete the self review.&lt;br /&gt;
&lt;br /&gt;
4. Go to view scores option.&lt;br /&gt;
|Submit the relevant assignment before doing the self review.&lt;br /&gt;
|The composite score is displayed in the heat map view.&lt;br /&gt;
|The student is able to see the composite score.&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|E1799_Test_Case_4&lt;br /&gt;
|Successfully displaying of composite score in alternate view.&lt;br /&gt;
|1. The student should do the self review.&lt;br /&gt;
2. The scores of the self review should be present in the database.&lt;br /&gt;
|1. Login to the Expertiza Application.&lt;br /&gt;
2. Submit the assignment created by the instructor by browsing it.&lt;br /&gt;
&lt;br /&gt;
3. Choose the self review option and complete the self review.&lt;br /&gt;
&lt;br /&gt;
4. Go to alternate scores option.&lt;br /&gt;
|Submit the relevant assignment before doing the self review.&lt;br /&gt;
|The composite score is displayed in the alternate scores view.&lt;br /&gt;
|The student is able to see the composite score.&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=='''References==&lt;br /&gt;
&lt;br /&gt;
http://wiki.expertiza.ncsu.edu/index.php/Main_Page&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase32.png&amp;diff=119632</id>
		<title>File:Ssdtusecase32.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase32.png&amp;diff=119632"/>
		<updated>2018-11-13T06:07:27Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase22.png&amp;diff=119631</id>
		<title>File:Ssdtusecase22.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase22.png&amp;diff=119631"/>
		<updated>2018-11-13T06:07:10Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase12.png&amp;diff=119630</id>
		<title>File:Ssdtusecase12.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase12.png&amp;diff=119630"/>
		<updated>2018-11-13T06:06:51Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase1.png&amp;diff=119629</id>
		<title>File:Ssdtusecase1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ssdtusecase1.png&amp;diff=119629"/>
		<updated>2018-11-13T06:05:40Z</updated>

		<summary type="html">&lt;p&gt;Dcbharma: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dcbharma</name></author>
	</entry>
</feed>