Skip to content

Commit

Permalink
Merge pull request #5958 from bbpennel/5955-file-analytics
Browse files Browse the repository at this point in the history
Fix method not found error for File analytics page
  • Loading branch information
cjcolvar authored Mar 27, 2023
2 parents 656f0ca + 648890f commit 0627a75
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions app/models/file_download_stat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ def ga_statistics(start_date, file)
Hyrax.logger.error("Google Analytics profile has not been established. Unable to fetch statistics.")
return []
end
profile.hyrax__analytics__google__download(sort: 'date',
start_date: start_date,
end_date: Date.yesterday,
limit: 10_000)
profile.hyrax__download(sort: 'date',
start_date: start_date,
end_date: Date.yesterday,
limit: 10_000)
.for_file(file.id)
end

Expand Down
8 changes: 4 additions & 4 deletions app/models/hyrax/statistic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ def ga_statistics(start_date, object)
Hyrax.logger.error("Google Analytics profile has not been established. Unable to fetch statistics.")
return []
end
profile.hyrax__analytics__google__pageviews(sort: 'date',
start_date: start_date,
end_date: Date.yesterday,
limit: 10_000)
profile.hyrax__pageview(sort: 'date',
start_date: start_date,
end_date: Date.yesterday,
limit: 10_000)
.for_path(path)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/models/file_download_stat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
end
context "when a profile is available" do
let(:views) { double }
let(:profile) { double(hyrax__analytics__google__download: views) }
let(:profile) { double(hyrax__download: views) }

it "calls the Legato method with the correct path" do
expect(views).to receive(:for_file).with(99)
Expand Down
2 changes: 1 addition & 1 deletion spec/models/work_view_stat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
end
context "when a profile is available" do
let(:views) { double }
let(:profile) { double(hyrax__analytics__google__pageviews: views) }
let(:profile) { double(hyrax__pageview: views) }

it "calls the Legato method with the correct path" do
expect(views).to receive(:for_path).with(expected_path)
Expand Down

0 comments on commit 0627a75

Please sign in to comment.