Open justinbmeyer opened 9 years ago
It looks like this is being converted in the model Order.List
at https://github.com/canjs/place-my-order/blob/master/app/models/order.js#L43.
The “service” is just a list of orders, so the data isn’t grouped like that until you’re in the model.
We could move that logic to the viewmodel, I think we both thought it belonged in the model.
As for it not rendering, it does because those properties exist, even if they don’t have a length. You can see in the example app, where the “in delivery” section has no orders.
So, on a second thought those if
s are not needed at all; about the naming, I'll rename the component to pmo-orders-list
, I think it makes more sense.
@chasenlehara it can be done in the model, but then you should probably have an Order.findAllGrouped
or something. Model's findAll / findOne / save / destroy are an interface where you could ideally make a grid, and pass it a Model, and that grid could use those methods to work. This original findAll changes the meaning of findAll to not return a flat list. I don't want to encourage that.
For now, I would do it in the view-model. Thanks.
it seems like the data is coming back as
{new: [...], preparing: [..]}
. We should not have a restful service return data this like way.Instead, the view-model should be doing this grouping.
Also, if there are no preparing / new, etc, the
<pmo-order-history-item>
would not be rendered, and probably not show "no new orders".