<commit_before># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.

from django.db.models import Q

from shuup.core.models import Order


class OrderReportMixin(object):
    def get_objects(self):
        queryset = Order.objects.filter(
            shop=self.shop,
            order_date__range=(self.start_date, self.end_date))
        creator = self.options.get("creator")
        orderer = self.options.get("orderer")
        customer = self.options.get("customer")
        filters = Q()
        if creator:
            filters &= Q(creator__in=creator)
        if orderer:
            filters &= Q(orderer__in=orderer)
        if customer:
            filters &= Q(customer__in=customer)

        return queryset.filter(filters).valid().paid().order_by("order_date")<commit_msg>Include orders which are made during selected end date in reports<commit_after># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from datetime import timedelta

from django.db.models import Q

from shuup.core.models import Order
from shuup.utils.dates import to_aware


class OrderReportMixin(object):
    def get_objects(self):
        start = to_aware(self.start_date)  # 0:00 on start_date
        end = to_aware(self.end_date) + timedelta(days=1)  # 24:00 on end_date
        queryset = Order.objects.filter(
            shop=self.shop, order_date__range=(start, end))
        creator = self.options.get("creator")
        orderer = self.options.get("orderer")
        customer = self.options.get("customer")
        filters = Q()
        if creator:
            filters &= Q(creator__in=creator)
        if orderer:
            filters &= Q(orderer__in=orderer)
        if customer:
            filters &= Q(customer__in=customer)

        return queryset.filter(filters).valid().paid().order_by("order_date")
{'fraction_non_alphanumeric': 0.1053109396277803, 'fraction_numerical': 0.013617793917385384, 'mean_word_length': 2.8330434782608696, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6589994', 'n_tokens_mistral': 669, 'n_tokens_neox': 645, 'n_words': 186}