<commit_before>var Item = require('./Item.js');
var List = require('./List.js');
var Utils = require('./Utils.js');

var App = class {
	constructor(lists = []) {
	   this.lists = lists;
  }
  getDueItems() {
    let dueItems = [];
    this.lists.forEach(function(list){
      let items = [];
      list.items.forEach(function(item) {
        if (item.date && Utils.dateDiffInDays(new Date(item.date), new Date()) > 0) {
          dueItems.push(item);
        }
      });
    });
    return dueItems;
  }
  getItemById(id) {
    for (let i = 0; i < this.lists.length; i++) {
      var item = this.lists[i].items.filter(i => i.id === id);
      if (item.length) {
        return item[0];
      }
    }
    return null;
  }
  getListById(id) {
  	let list = this.lists.filter(l => l.id === id);
  	return ((list.length)? list[0] : null);
  }
  render() {
    let pastDueList = new List("Past Due", this.getDueItems(), false);
  	let html = `<div class="app">
  					<div class="btn add-list success" data-action="add-list">[+] Add List</div>
  				`;
  	this.lists.forEach(function (list) {
      html += list.render();
    });
    html += pastDueList.render();
    html += '</div>';
    return html;
  }
  add(list) {
    this.lists.push(list);
  }
  remove(list) {
    this.lists = this.lists.filter(l => (l.id !== list.id));
  }
}

module.exports = App;<commit_msg>Fix past due date & complete bug<commit_after>var Item = require('./Item.js');
var List = require('./List.js');
var Utils = require('./Utils.js');
var Status = require('./Status.js');

var App = class {
	constructor(lists = []) {
	   this.lists = lists;
  }
  getDueItems() {
    let dueItems = [];
    this.lists.forEach(function(list){
      let items = [];
      list.items.forEach(function(item) {
        if (item.date && item.status === Status.PENDING && Utils.dateDiffInDays(new Date(item.date), new Date()) > 0) {
          dueItems.push(item);
        }
      });
    });
    return dueItems;
  }
  getItemById(id) {
    for (let i = 0; i < this.lists.length; i++) {
      var item = this.lists[i].items.filter(i => i.id === id);
      if (item.length) {
        return item[0];
      }
    }
    return null;
  }
  getListById(id) {
  	let list = this.lists.filter(l => l.id === id);
  	return ((list.length)? list[0] : null);
  }
  render() {
    let pastDueList = new List("Past Due", this.getDueItems(), false);
  	let html = `<div class="app">
  					<div class="btn add-list success" data-action="add-list">[+] Add List</div>
  				`;
  	this.lists.forEach(function (list) {
      html += list.render();
    });
    html += pastDueList.render();
    html += '</div>';
    return html;
  }
  add(list) {
    this.lists.push(list);
  }
  remove(list) {
    this.lists = this.lists.filter(l => (l.id !== list.id));
  }
}

module.exports = App;
{'fraction_non_alphanumeric': 0.19326241134751773, 'fraction_numerical': 0.0028368794326241137, 'mean_word_length': 2.491336633663366, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, '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': '3983883', 'n_tokens_mistral': 1024, 'n_tokens_neox': 995, 'n_words': 207}