diff --git a/app/controllers/metrics_controller.rb b/app/controllers/metrics_controller.rb deleted file mode 100644 index f164f23515..0000000000 --- a/app/controllers/metrics_controller.rb +++ /dev/null @@ -1,23 +0,0 @@ -class MetricsController < ApplicationController - include AuthorizationHelper - include AssignmentHelper - include GithubMetricsHelper - - def action_allowed? - current_user_has_instructor_privileges? - end - - # This populates the database fields required to display user contributions in the view_team for grades heatgrid. - # It executes a query for all link submissions for an entire assignment, and runs the necessary queries to enable the - # "Github metrics" link on the list_assignments page. - # def query_assignment_statistics - # @assignment = Assignment.find(params[:id]) - # teams = @assignment.teams - # teams.each do |team| - # topic_identifier, topic_name, users_for_curr_team, participants = get_data_for_list_submissions(team) - # github_metrics_for_submission(participants.first.id) unless participants.first.nil? - # end - # redirect_to controller: 'assignments', action: 'list_submissions', id: @assignment.id - # end - -end diff --git a/app/helpers/github_metrics_helper.rb b/app/helpers/github_metrics_helper.rb index 3fcb1c9910..3f49a4b84c 100644 --- a/app/helpers/github_metrics_helper.rb +++ b/app/helpers/github_metrics_helper.rb @@ -105,7 +105,7 @@ def sort_commit_dates end # There may or may not be an associated username in expertiza related to the github account if - # a team member accidentally pushed to their repoistory with the wrong account, in this case + # a team member accidentally pushed to their repository with the wrong account, in this case # use the github name assosicated with that account instead of the expertiza username def expertiza_username(author) github_association = GithubAssociation.find_by_github_user(author[1]) diff --git a/app/models/metric.rb b/app/models/metric.rb deleted file mode 100644 index 2c22e2cf4d..0000000000 --- a/app/models/metric.rb +++ /dev/null @@ -1,44 +0,0 @@ -class Metric < ActiveRecord::Base - # Constants for GraphQL queries. - PULL_REQUEST_QUERY = <<~QUERY - query { - repository(owner: "%s", name: "%s") { - pullRequest(number: %s) { - number additions deletions changedFiles mergeable merged headRefOid - commits(first: 100 %s) { - totalCount - pageInfo { - hasNextPage startCursor endCursor - } - edges { - node { - id commit { - author { - name email user{login} - } - additions deletions changedFiles committedDate - } - } - } - } - } - } - } - QUERY - - # Generate the GraphQL query text for a PULL REQUEST link. - # - # hyperlink_data - a hash containing the owner name, repository name, and pull request number. - # after - a pointer provided by the Github API to where the last query left off. - # - # Returns a hash containing the query text. - def self.pull_query(hyperlink_data) - format(PULL_REQUEST_QUERY, { - owner_name: hyperlink_data["owner_name"], - repository_name: hyperlink_data["repository_name"], - pull_request_number: hyperlink_data["pull_request_number"], - after_clause: nil - }) - end - -end diff --git a/app/views/metrics/query_assignment_statistics.html.erb b/app/views/metrics/query_assignment_statistics.html.erb deleted file mode 100644 index 6190d79c4a..0000000000 --- a/app/views/metrics/query_assignment_statistics.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Querying Github Metrics For: <%= @assignment.name %>

- -

Success! Window will automatically close.

- \ No newline at end of file diff --git a/app/views/metrics/show.html.erb b/app/views/metrics/show.html.erb deleted file mode 100644 index b2e307ce0a..0000000000 --- a/app/views/metrics/show.html.erb +++ /dev/null @@ -1,102 +0,0 @@ -<% status_classes = {"failure" => "failed", "success" => "passed"} %> -

GitHub Metrics for assignment: <%= @assignment.name %>

-

Team: <%= @team.name %>

- - -<% topic_id, topic_name, users_for_curr_team, participants = get_metrics_for_list_submissions(@team) %> -<% if @assignment.topics? %> -

Topic: <%= topic_id + '. ' + topic_name %>

-<% end %> - - - -

- - -<% if @parsed_metrics && @authors.present? && @dates %> - - - - - - - - - - -

Code Frequency

Total Contributions by Author

-
- <%= display_bar_chart(@parsed_metrics, @authors, @dates) %> -
-
-
- -
-
- - -

Team Statistics

-
    -
  • Total number of commits:<%= @total_commits %>
  • -
  • Total number of lines added: <%= @total_additions %>
  • -
  • Total number of lines removed: <%= @total_deletions %>
  • -
  • Total number of files changed: <%= @total_files_changed %>
  • - <% unless @merge_status[-1]%> -
  • -
    Merge statuses:
    -
      - <% @merge_status.each do |k, v| %> -
    • Pull Request Number <%= k %> has status: <%= v %>
    • - <% end %> -
    -
  • -
  • - Check Statuses: - <% if @check_statuses.empty? %> - NA - <% else %> -
      - <% @check_statuses.each do |pull_number, check_status| %> -
    • -
      Pull request: <%= pull_number %>
      -
      Overall Status: ><%= check_status["state"] %>
      - <% if check_status["statuses"].present? %> -
      Results:
      -
        - <% check_status["statuses"].each do |status| %> -
      • <%= status["context"] %> -
        Check status: ><%= status["state"] %>
        -
        Check description: <%= status["description"] || "NA" %>
        -
      • - <% end %> -
      - <% end %> -
    • - <% end %> -
    - <% end %> - <% end %> -
  • -
-<% else %> -

No github data to show

-<% end %> \ No newline at end of file diff --git a/db/migrate/20230322193859_create_metrics.rb b/db/migrate/20230322193859_create_metrics.rb deleted file mode 100644 index 0f47e63682..0000000000 --- a/db/migrate/20230322193859_create_metrics.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateMetrics < ActiveRecord::Migration[4.2] - def up - create_table :metrics do |t| - t.integer :team_id - t.string :github_id - t.integer :participant_id - t.integer :total_commits - t.timestamps null: false - end - end - def down - drop_table :metrics - remove_column :users, :github_id - end -end