Top Ten Articles with the most flagged comments
-
+
Top ten comments with the most likes
diff --git a/client/coral-admin/src/graphql/queries/index.js b/client/coral-admin/src/graphql/queries/index.js
index a0cceb0c7..9b8a51216 100644
--- a/client/coral-admin/src/graphql/queries/index.js
+++ b/client/coral-admin/src/graphql/queries/index.js
@@ -3,7 +3,20 @@ import {graphql} from 'react-apollo';
import MOST_FLAGS from './mostFlags.graphql';
import MOD_QUEUE_QUERY from './modQueueQuery.graphql';
-export const mostFlags = graphql(MOST_FLAGS, {});
+export const mostFlags = graphql(MOST_FLAGS, {
+ options: () => {
+
+ // currently hard-coded per Greg's advice
+ const fiveMinutesAgo = new Date();
+ fiveMinutesAgo.setMinutes(fiveMinutesAgo.getMinutes() - 5);
+ return {
+ variables: {
+ from: fiveMinutesAgo.toISOString(),
+ to: new Date().toISOString()
+ }
+ };
+ }
+});
export const modQueueQuery = graphql(MOD_QUEUE_QUERY, {
options: ({params: {id = ''}}) => {
diff --git a/client/coral-admin/src/graphql/queries/mostFlags.graphql b/client/coral-admin/src/graphql/queries/mostFlags.graphql
index 229d64541..1bcec7a1e 100644
--- a/client/coral-admin/src/graphql/queries/mostFlags.graphql
+++ b/client/coral-admin/src/graphql/queries/mostFlags.graphql
@@ -1,5 +1,12 @@
-query mostFlags {
- metric {
+query Metrics ($from: Date!, $to: Date!) {
+ metrics(from: $from, to: $to) {
id
+ title
+ url
+ commentCount
+ action_summaries {
+ actionCount
+ actionableItemCount
+ }
}
}
diff --git a/client/coral-docs/src/services/fetcher.js b/client/coral-docs/src/services/fetcher.js
index e4d6f091d..aec448762 100644
--- a/client/coral-docs/src/services/fetcher.js
+++ b/client/coral-docs/src/services/fetcher.js
@@ -1,5 +1,5 @@
export default function fetcher(query) {
- return fetch(`${window.location.host}/api/v1/graph/ql`, {
+ return fetch(`${window.location.origin}/api/v1/graph/ql`, {
method: 'POST',
headers: {
Accept: 'application/json',