-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
include events in usage reports. #260
- Loading branch information
Martin Fenner
committed
May 17, 2019
1 parent
0bf039e
commit d697d5f
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
app/graphql/types/usage_report_dataset_connection_with_meta_type.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class UsageReportDatasetConnectionWithMetaType < BaseConnection | ||
edge_type(EventDataEdgeType, edge_class: EventDataEdge) | ||
field_class GraphQL::Cache::Field | ||
|
||
field :total_count, Integer, null: false, cache: true | ||
|
||
def total_count | ||
Event.query(nil, subj_id: object.parent[:id], source_id: "datacite-usage").dig(:meta, "total").to_i | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters