diff --git a/action/dist/index.js b/action/dist/index.js index 6d448a73..fe8d4675 100644 --- a/action/dist/index.js +++ b/action/dist/index.js @@ -223,16 +223,16 @@ var E_Users_lecoq_Documents_GitHub_gitstats_node_modules_axios_index_default = / //Check if plugin is enabled and requirements are met if ((!enabled)||(!q.isocalendar)) return null - //Compute start day (need to ) + //Compute start day (need to start on monday to ensure last row is complete) const from = new Date(Date.now()-180*24*60*60*1000) const day = from.getDay()||7 if (day !== 1) from.setHours(-24*(day-1)) - //Retrieve more data from contribution calendar + //Retrieve contribution calendar from graphql api const {user:{calendar:{contributionCalendar:calendar}}} = await graphql(` query Calendar { - user(login: $login) { - calendar:contributionsCollection(from: $calendar.from, to: $calendar.to) { + user(login: "${login}") { + calendar:contributionsCollection(from: "${from.toISOString()}", to: "${(new Date()).toISOString()}") { contributionCalendar { weeks { contributionDays { @@ -246,11 +246,8 @@ var E_Users_lecoq_Documents_GitHub_gitstats_node_modules_axios_index_default = / } } ` - .replace(/[$]login/, `"${login}"`) - .replace(/[$]calendar.to/, `"${(new Date()).toISOString()}"`) - .replace(/[$]calendar.from/, `"${from.toISOString()}"`) ) - //Compute max contribution per day to scale + //Compute the highest contributions in a day, streaks and average commits per day let max = 0, streak = {max:0, current:0}, values = [], average = 0 for (const week of calendar.weeks) { for (const day of week.contributionDays) { @@ -266,20 +263,13 @@ var E_Users_lecoq_Documents_GitHub_gitstats_node_modules_axios_index_default = / let i = 0, j = 0 let svg = ` - - - - - - - - - - - - - - + ${[1, 2].map(k => ` + + + ${[..."RGB"].map(channel => ``).join("")} + + ` + ).join("")} ` //Iterate through weeks for (const week of calendar.weeks) { diff --git a/src/plugins/isocalendar/index.mjs b/src/plugins/isocalendar/index.mjs index 847b5f0d..6bc85b45 100644 --- a/src/plugins/isocalendar/index.mjs +++ b/src/plugins/isocalendar/index.mjs @@ -5,16 +5,16 @@ //Check if plugin is enabled and requirements are met if ((!enabled)||(!q.isocalendar)) return null - //Compute start day (need to ) + //Compute start day (need to start on monday to ensure last row is complete) const from = new Date(Date.now()-180*24*60*60*1000) const day = from.getDay()||7 if (day !== 1) from.setHours(-24*(day-1)) - //Retrieve more data from contribution calendar + //Retrieve contribution calendar from graphql api const {user:{calendar:{contributionCalendar:calendar}}} = await graphql(` query Calendar { - user(login: $login) { - calendar:contributionsCollection(from: $calendar.from, to: $calendar.to) { + user(login: "${login}") { + calendar:contributionsCollection(from: "${from.toISOString()}", to: "${(new Date()).toISOString()}") { contributionCalendar { weeks { contributionDays { @@ -28,11 +28,8 @@ } } ` - .replace(/[$]login/, `"${login}"`) - .replace(/[$]calendar.to/, `"${(new Date()).toISOString()}"`) - .replace(/[$]calendar.from/, `"${from.toISOString()}"`) ) - //Compute max contribution per day to scale + //Compute the highest contributions in a day, streaks and average commits per day let max = 0, streak = {max:0, current:0}, values = [], average = 0 for (const week of calendar.weeks) { for (const day of week.contributionDays) { @@ -48,20 +45,13 @@ let i = 0, j = 0 let svg = ` - - - - - - - - - - - - - - + ${[1, 2].map(k => ` + + + ${[..."RGB"].map(channel => ``).join("")} + + ` + ).join("")} ` //Iterate through weeks for (const week of calendar.weeks) {