diff --git a/app/assets/javascripts/components/overview/course_stats_download_modal.jsx b/app/assets/javascripts/components/overview/course_stats_download_modal.jsx index a3eb8052b4..f7c2247eb6 100644 --- a/app/assets/javascripts/components/overview/course_stats_download_modal.jsx +++ b/app/assets/javascripts/components/overview/course_stats_download_modal.jsx @@ -17,7 +17,6 @@ const CourseStatsDownloadModal = ({ course }) => { } const overviewCsvLink = `/course_csv?course=${course.slug}`; - const editsCsvLink = `/course_edits_csv?course=${course.slug}`; const uploadsCsvLink = `/course_uploads_csv?course=${course.slug}`; const studentsCsvLink = `/course_students_csv?course=${course.slug}`; const articlesCsvLink = `/course_articles_csv?course=${course.slug}`; @@ -47,11 +46,6 @@ const CourseStatsDownloadModal = ({ course }) => { {I18n.t('courses.data_overview_info')}
- {I18n.t('courses.data_edits')} - {I18n.t('courses.data_edits_info')} -
-{I18n.t('courses.data_uploads')} {I18n.t('courses.data_uploads_info')} diff --git a/app/controllers/analytics_controller.rb b/app/controllers/analytics_controller.rb index 5372bd7df0..353f679640 100644 --- a/app/controllers/analytics_controller.rb +++ b/app/controllers/analytics_controller.rb @@ -3,7 +3,6 @@ require_dependency "#{Rails.root}/lib/analytics/monthly_report" require_dependency "#{Rails.root}/lib/analytics/course_statistics" require_dependency "#{Rails.root}/lib/analytics/course_csv_builder" -require_dependency "#{Rails.root}/lib/analytics/course_edits_csv_builder" require_dependency "#{Rails.root}/lib/analytics/course_uploads_csv_builder" require_dependency "#{Rails.root}/lib/analytics/course_students_csv_builder" require_dependency "#{Rails.root}/lib/analytics/course_articles_csv_builder" @@ -18,7 +17,7 @@ class AnalyticsController < ApplicationController layout 'admin' include CourseHelper before_action :require_signed_in, only: :ungreeted - before_action :set_course, only: %i[course_csv course_edits_csv course_uploads_csv + before_action :set_course, only: %i[course_csv course_uploads_csv course_students_csv course_articles_csv course_revisions_csv course_wikidata_csv] @@ -56,12 +55,6 @@ def course_csv filename: "#{@course.slug}-#{Time.zone.today}.csv" end - def course_edits_csv - course = find_course_by_slug(params[:course]) - send_data CourseEditsCsvBuilder.new(course).generate_csv, - filename: "#{course.slug}-edits-#{Time.zone.today}.csv" - end - def tagged_courses_csv tag = params[:tag] send_data TaggedCoursesCsvBuilder.new(tag).generate_csv, diff --git a/config/routes.rb b/config/routes.rb index 61866bff13..0872bbf629 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -249,7 +249,6 @@ get 'usage' => 'analytics#usage' get 'ungreeted' => 'analytics#ungreeted' get 'course_csv' => 'analytics#course_csv' - get 'course_edits_csv' => 'analytics#course_edits_csv' get 'course_uploads_csv' => 'analytics#course_uploads_csv' get 'course_students_csv' => 'analytics#course_students_csv' get 'course_articles_csv' => 'analytics#course_articles_csv' diff --git a/lib/analytics/course_edits_csv_builder.rb b/lib/analytics/course_edits_csv_builder.rb deleted file mode 100644 index 649aef20d2..0000000000 --- a/lib/analytics/course_edits_csv_builder.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -require 'csv' - -class CourseEditsCsvBuilder - include ArticleHelper - - def initialize(course) - @course = course - end - - def generate_csv - csv_data = [CSV_HEADERS] - @course.revisions.includes(:wiki, :article, :user).each do |revision| - csv_data << row(revision) - end - CSV.generate { |csv| csv_data.each { |line| csv << line } } - end - - private - - CSV_HEADERS = %w[ - revision_id - timestamp - wiki - article_title - diff - username - bytes_added - references_added - new_article - dashboard_edit - ].freeze - def row(revision) - row = [revision.mw_rev_id] - row << revision.date - row << revision.wiki.base_url - row << revision.article.full_title - row << revision.url - row << revision.user.username - row << revision.characters - row << revision.references_added - row << revision.new_article - row << revision.system - end -end diff --git a/spec/controllers/analytics_controller_spec.rb b/spec/controllers/analytics_controller_spec.rb index 24f8328e94..c5d02b0e46 100644 --- a/spec/controllers/analytics_controller_spec.rb +++ b/spec/controllers/analytics_controller_spec.rb @@ -82,15 +82,6 @@ end end - describe '#course_edits_csv' do - let(:course) { create(:course, slug: 'foo/bar_(baz)') } - - it 'returns a CSV' do - get '/course_edits_csv', params: { course: course.slug } - expect(response.body).to include('revision_id') - end - end - describe '#course_uploads_csv' do let(:course) { create(:course, slug: 'foo/bar_(baz)') } diff --git a/spec/lib/analytics/course_edits_csv_builder_spec.rb b/spec/lib/analytics/course_edits_csv_builder_spec.rb deleted file mode 100644 index fb8d18d629..0000000000 --- a/spec/lib/analytics/course_edits_csv_builder_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' -require "#{Rails.root}/lib/analytics/course_edits_csv_builder" - -describe CourseEditsCsvBuilder do - let(:course) { create(:course) } - let(:user) { create(:user) } - let(:article) { create(:article) } - let!(:courses_user) { create(:courses_user, course:, user:) } - let(:revision_count) { 5 } - let(:subject) { described_class.new(course).generate_csv } - - before do - # revisions during the course - revision_count.times do |i| - create(:revision, mw_rev_id: i, user:, date: course.start + 1.minute, article:) - end - # revision outside the course - create(:revision, mw_rev_id: 123, user:, date: course.start - 1.minute) - end - - it 'creates a CSV with a header and a row of data for each course revision' do - expect(subject.split("\n").count).to eq(revision_count + 1) - end -end