<commit_before>class ShoplistCtrl {
    constructor(StorageModel, MealModel, ShopListService) {
        Object.assign(this, {StorageModel, MealModel, ShopListService});

        const today = moment();
        this.title = Mealpler.titles.shopList;
        this.rangeStart = today.startOf('week');
        this.rangeLength = 7;
        this.init();
    }
    addItem(newItem) {
        this.StorageModel.addItemToGroceryList(newItem);
        this.init();
    }

    addItems(listOfMeals) {
        let newItems = [];
        listOfMeals.map(a => a.mealList.forEach(b => b.type === 'product' ? newItems.push(b) : b.list.forEach(c => newItems.push(c))));
        this.StorageModel.addItemToGroceryList(newItems);
        this.grocery.init();
    }

    deleteItem(item) {
        this.StorageModel.deleteGroceryItem(item);
        this.grocery.init();
    }

    deleteAll() {
        this.StorageModel.deleteGrocery();
        this.grocery.init();
    }

    init(start, duration) {
        const newStart = start || this.rangeStart;
        const newDuration = duration || this.rangeLength;
        const storedItems = this.MealModel.findDateRangeMealList(newStart, newDuration);
        this.list = this.ShopListService.extractAndSortProducts(storedItems);
    }
}

Mealpler.controller('ShoplistCtrl', ShoplistCtrl);<commit_msg>MP-34: added MealService dependency<commit_after>class ShoplistCtrl {
    constructor(StorageModel, MealModel, ShopListService, MealService) {
        Object.assign(this, {StorageModel, MealModel, ShopListService, MealService});

        const today = moment();
        this.title = Mealpler.titles.shopList;
        this.rangeStart = today.startOf('week');
        this.rangeLength = 7;
        this.init();
    }
    addItem(newItem) {
        this.StorageModel.addItemToGroceryList(newItem);
        this.init();
    }

    addItems(listOfMeals) {
        let newItems = [];
        listOfMeals.map(a => a.mealList.forEach(b => b.type === 'product' ? newItems.push(b) : b.list.forEach(c => newItems.push(c))));
        this.StorageModel.addItemToGroceryList(newItems);
        this.grocery.init();
    }

    deleteItem(item) {
        this.StorageModel.deleteGroceryItem(item);
        this.grocery.init();
    }

    deleteAll() {
        this.StorageModel.deleteGrocery();
        this.grocery.init();
    }

    init(start, duration) {
        const newStart = start || this.rangeStart;
        const newDuration = duration || this.rangeLength;
        const storedItems = this.MealService.findDateRangeMealList(newStart, newDuration);
        this.list = this.ShopListService.extractAndSortProducts(storedItems);
    }
}

Mealpler.controller('ShoplistCtrl', ShoplistCtrl);
{'fraction_non_alphanumeric': 0.12767527675276752, 'fraction_numerical': 0.0014760147601476014, 'mean_word_length': 2.923299565846599, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6981982', 'n_tokens_mistral': 854, 'n_tokens_neox': 822, 'n_words': 120}