Skip to content

Commit

Permalink
feat: Detect parcticing/notPracticing based on date of commit and dat…
Browse files Browse the repository at this point in the history
…e of PR minus 30 days
  • Loading branch information
adelkahomolova committed Nov 20, 2019
1 parent 648f066 commit 1948193
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/practices/LanguageIndependent/DoesPullRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ export class DoesPullRequests implements IPractice {
const ownerAndRepoName = GitServiceUtils.getOwnerAndRepoName(repoName);

const pullRequests = await ctx.collaborationInspector.getPullRequests(ownerAndRepoName.owner, ownerAndRepoName.repoName);
if (pullRequests.items.length > 0) {
const repoCommits = await ctx.collaborationInspector.getRepoCommits(ownerAndRepoName.owner, ownerAndRepoName.repoName);

const prDate = new Date(repoCommits.items[0].author.date).getTime();
const commitDate = new Date(pullRequests.items[0].createdAt).getTime();

if (prDate - 1000 * 60 * 60 * 24 * 30 < commitDate) {
return PracticeEvaluationResult.practicing;
}

Expand Down

0 comments on commit 1948193

Please sign in to comment.