Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rotem Orbach 121 posts 607 karma points
    Sep 02, 2021 @ 08:59
    Rotem Orbach
    0

    uCommerce PurchaseOrder Sales Report Query

    Hi,

    We are experiencing troubling behavior with getting uCommerce reports of sales and there is not much optimization we can do here since it’s based on Umbraco objects and not on C# or SQL.

    IEnumerable<PurchaseOrder> results = PurchaseOrder.Find(p => (p.CompletedDate >= start_date && p.CompletedDate <= end_date && p.OrderStatus == OrderStatus.Get((int)OrderStatusCode.Paid)));
    

    It used to work using a date range of even a week. Now it fails on a date range of a single day!

    It's been like this for a few days now. On a (rare) good day we are able to run it on a date range of a single day only, but not more than that!

    We are getting 504 error and are therefore unable to create any reports.

    Any help would be appreciated :)

    Many thanks

    Rotem

  • Bjarne Fyrstenborg 1282 posts 3994 karma points MVP 8x c-trib
    Sep 05, 2021 @ 14:36
    Bjarne Fyrstenborg
    0

    Hi Rotem

    Depending on the number of orders in the database, the query may not perform very well. It looks like you lookup order status for each order, instead of just compare the order status id, e.g.

    IEnumerable<PurchaseOrder> results = PurchaseOrder.Find(p => (p.CompletedDate >= start_date && p.CompletedDate <= end_date && p.OrderStatus.OrderStatusId == (int)OrderStatusCode.Paid));
    

    /Bjarne

  • Rotem Orbach 121 posts 607 karma points
    Sep 09, 2021 @ 10:41
    Rotem Orbach
    0

    Thank you for noticing that :)

    It may not be the root cause but it's already an improvement

Please Sign in or register to post replies

Write your reply to:

Draft