<commit_before><html>
<head>
  <title></title>
  <script type="text/javascript" src="../d3.min.js"></script>
  <script src="./jquery.min.js"></script>
  <script src="./dgw-git-contributors.json"></script>

<style type="text/css">
.day {
  width:20;
  height:20;
  stroke:rgb(255,255,255);
}

</style>
</head>
<body>
<p></p>
<p></p>
<script type="text/javascript">
/*
Info on the API calls necessary:

A separate call is made for each of the following:
- Progress made in the previous work week (two Fridays ago to previous Friday), in order to compare with...
- Progress made in the current work week. (two API calls are needed to work with the 'until' and 'since' parameters)
- Contributors to the repository

Assumptions (for now)
- Desire the progress made since the last DG meeting, and not since exactly one week prior. (hence Friday)
- Most activity is committed to main branch and is otherwise not too convoluted. (this pulls info from all branches)

 */

/*var req = new XMLHttpRequest();
var twoweeks = new Date();

twoweeks.setDate(twoweeks.getDate() - (twoweeks.getDay() + 2) - 7);
console.log(twoweeks);
oneweek = new Date(twoweeks);
oneweek.setDate(oneweek.getDate() + 7)
console.log(twoweeks + ' until ' + oneweek);
req.open('GET', 'https://api.github.com/repos/developersguild/dgwebsite2/commits?sha=master&since=' + twoweeks + '&until=' + oneweek, true);
req.send();

req.onreadystatechange = function(){
  console.log(req.responseText);
}*/

/*var contributions = []

d3.select('body').selectAll('p')
  .data(contributors).enter()
  .append('p').text(function(contributor){
    contributions.push({eval(contributor.login) : new Array()});
    return '@' + contributor.login;
  });

wks_2.forEach(function(c) {
  contributions[c.author.login].push(c);
})

console.log(contributions);
*/

//var cont = d3.select('body').selectAll('svg').append();

// sample, given a project array:
/*projects[0] = [
  {
    login: [
      {
        'date': Date object,
        'message': 'yada',
        'url': 'foo'
      }
    ]
  }
]*/

// Defining models to store commits

var ROOF_COMMITS = 5;

var Project = function(name) {
  this.name = name;
  this.contributors = {};
}

Project.prototype.appendCommit = function(login, commit) {
  // commit format: date, msg, url
  var date = commit.date;
  var week_offset = date.getDay();

  var histogram = new Array()
  for (var i = 0; i < 7; i++) histogram.push(0);

  if (this.contributors[login] == undefined) {
    this.contributors[login] = {
      'commits': new Array(),
      'hist': histogram
    }
  }

  this.contributors[login].commits.push({
    'date': date,
    'msg': commit.msg,
    'url': commit.url,
    'week_offset': week_offset // TODO: normalize 0 to previous Friday (day of meeting). Currently normalizes to Sunday as 0
  });

  this.contributors[login].hist[week_offset]++;

}

// generates random Date object within the next 7 days
function genRanDate() {
  var today = new Date();
  return new Date(today.setDate(today.getDate() + Math.round(Math.random()*7)));
}

var today = new Date();
var dgw = new Project('dgwebsite');
dgw.appendCommit('@a', {'date': genRanDate(), 'msg': 'yada', 'url': 'sampleurl' })
dgw.appendCommit('@b', {'date': genRanDate(), 'msg': 'yada', 'url': 'sampleurl' })
dgw.appendCommit('@a', {'date': genRanDate(), 'msg': 'bada', 'url': 'sampleurl' })

// TODO: parse Github fetch -> maps to model


// D3 init
var pC = d3.select('body').append('svg'); // projectContainer
var dgw_entries = d3.entries(dgw.contributors)
var contributor_row = pC.selectAll('rect')
  .data(dgw_entries)
  .enter()
  .append('g')
  .attr('class', 'contributor');

contributor_row.selectAll('rect')
  .data(function(d){return d.value.commits})
  .enter()
  .append('rect')
  .attr('class', 'day')
  .attr('x', function(d) {
    return d.week_offset * 20 + 30;
  })
  .attr('y', function(d,i,j) {
    return j * 20;
  })
  .attr('fill', function(d,i,j) {
    var val = ( 1 - ( dgw_entries[j].value.hist[d.week_offset] / ROOF_COMMITS ) )* 255;
    return 'rgb(' + val + ',' + val + ',' + val + ')';
  })

contributor_row.append('text')
  .text(function(d){
    return d.key;
  })
  .attr('fill', 'rgb(0,0,0)')
  .attr('y', function(d,i) {
    return i * 20 + 20;
  })

// TODO: d3.scale


</script>

</body>
</html>
<commit_msg>Changes from previous commit are more apparent in a demo.<commit_after><html>
<head>
  <title></title>
  <script type="text/javascript" src="../d3.min.js"></script>
  <script src="./jquery.min.js"></script>
  <script src="./dgw-git-contributors.json"></script>

<style type="text/css">
.day {
  width:20;
  height:20;
  stroke:rgb(255,255,255);
}

</style>
</head>
<body>
<p></p>
<p></p>
<script type="text/javascript">
/*
Info on the API calls necessary:

A separate call is made for each of the following:
- Progress made in the previous work week (two Fridays ago to previous Friday), in order to compare with...
- Progress made in the current work week. (two API calls are needed to work with the 'until' and 'since' parameters)
- Contributors to the repository

Assumptions (for now)
- Desire the progress made since the last DG meeting, and not since exactly one week prior. (hence Friday)
- Most activity is committed to main branch and is otherwise not too convoluted. (this pulls info from all branches)

 */

/*var req = new XMLHttpRequest();
var twoweeks = new Date();

twoweeks.setDate(twoweeks.getDate() - (twoweeks.getDay() + 2) - 7);
console.log(twoweeks);
oneweek = new Date(twoweeks);
oneweek.setDate(oneweek.getDate() + 7)
console.log(twoweeks + ' until ' + oneweek);
req.open('GET', 'https://api.github.com/repos/developersguild/dgwebsite2/commits?sha=master&since=' + twoweeks + '&until=' + oneweek, true);
req.send();

req.onreadystatechange = function(){
  console.log(req.responseText);
}*/

/*var contributions = []

d3.select('body').selectAll('p')
  .data(contributors).enter()
  .append('p').text(function(contributor){
    contributions.push({eval(contributor.login) : new Array()});
    return '@' + contributor.login;
  });

wks_2.forEach(function(c) {
  contributions[c.author.login].push(c);
})

console.log(contributions);
*/

//var cont = d3.select('body').selectAll('svg').append();

// sample, given a project array:
/*projects[0] = [
  {
    login: [
      {
        'date': Date object,
        'message': 'yada',
        'url': 'foo'
      }
    ]
  }
]*/

// Defining models to store commits

var ROOF_COMMITS = 5;

var Project = function(name) {
  this.name = name;
  this.contributors = {};
}

Project.prototype.appendCommit = function(login, commit) {
  // commit format: date, msg, url
  var date = commit.date;
  var week_offset = date.getDay();

  var histogram = new Array()
  for (var i = 0; i < 7; i++) histogram.push(0);

  if (this.contributors[login] == undefined) {
    this.contributors[login] = {
      'commits': new Array(),
      'hist': histogram
    }
  }

  this.contributors[login].commits.push({
    'date': date,
    'msg': commit.msg,
    'url': commit.url,
    'week_offset': week_offset // TODO: normalize 0 to previous Friday (day of meeting). Currently normalizes to Sunday as 0
  });

  this.contributors[login].hist[week_offset]++;

}

// generates random Date object within the next 7 days
function genRanDate() {
  var today = new Date();
  return new Date(today.setDate(today.getDate() + Math.round(Math.random()*7)));
}

var today = new Date();
var dgw = new Project('dgwebsite');
dgw.appendCommit('@a', {'date': genRanDate(), 'msg': 'yada', 'url': 'sampleurl' })
dgw.appendCommit('@b', {'date': genRanDate(), 'msg': 'yada', 'url': 'sampleurl' })
dgw.appendCommit('@a', {'date': genRanDate(), 'msg': 'bada', 'url': 'sampleurl' })
dgw.appendCommit('@a', {'date': genRanDate(), 'msg': 'bada', 'url': 'sampleurl' })
dgw.appendCommit('@a', {'date': genRanDate(), 'msg': 'bada', 'url': 'sampleurl' })
dgw.appendCommit('@a', {'date': genRanDate(), 'msg': 'bada', 'url': 'sampleurl' })
dgw.appendCommit('@b', {'date': genRanDate(), 'msg': 'bada', 'url': 'sampleurl' })
dgw.appendCommit('@b', {'date': genRanDate(), 'msg': 'bada', 'url': 'sampleurl' })
dgw.appendCommit('@b', {'date': genRanDate(), 'msg': 'bada', 'url': 'sampleurl' })
dgw.appendCommit('@b', {'date': genRanDate(), 'msg': 'bada', 'url': 'sampleurl' })
dgw.appendCommit('@b', {'date': genRanDate(), 'msg': 'bada', 'url': 'sampleurl' })
dgw.appendCommit('@b', {'date': genRanDate(), 'msg': 'bada', 'url': 'sampleurl' })
dgw.appendCommit('@b', {'date': genRanDate(), 'msg': 'bada', 'url': 'sampleurl' })


// TODO: parse Github fetch -> maps to model


// D3 init
var pC = d3.select('body').append('svg'); // projectContainer
var dgw_entries = d3.entries(dgw.contributors)
var contributor_row = pC.selectAll('rect')
  .data(dgw_entries)
  .enter()
  .append('g')
  .attr('class', 'contributor');

contributor_row.selectAll('rect')
  .data(function(d){return d.value.commits})
  .enter()
  .append('rect')
  .attr('class', 'day')
  .attr('x', function(d) {
    return d.week_offset * 20 + 30;
  })
  .attr('y', function(d,i,j) {
    return j * 20;
  })
  .attr('fill', function(d,i,j) {
    var val = ( 1 - ( dgw_entries[j].value.hist[d.week_offset] / ROOF_COMMITS ) )* 255;
    return 'rgb(' + val + ',' + val + ',' + val + ')';
  })

contributor_row.append('text')
  .text(function(d){
    return d.key;
  })
  .attr('fill', 'rgb(0,0,0)')
  .attr('y', function(d,i) {
    return i * 20 + 20;
  })

// TODO: d3.scale


</script>

</body>
</html>

{'fraction_non_alphanumeric': 0.19506277033442346, 'fraction_numerical': 0.010760628758307838, 'mean_word_length': 3.994731296101159, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3101533', 'n_tokens_mistral': 3509, 'n_tokens_neox': 3393, 'n_words': 831}