paperos-labs / feedback

Just a bug and ideas board
0 stars 0 forks source link

TODO's not being marked as completed #221

Closed wmerfalen closed 2 years ago

wmerfalen commented 2 years ago

What URL?

https://demo.savvi.legal/c/290/all-dashboards this is for user Matt+demo@savvi.legal password: qwer1234S I completed one task submission that made the to-do disappear, but I have two others that have already been submitted, and I can't figure out a way to complete the to-dos at this point.

What were you trying to do? What broke?

"To-dos in the My Dashboard view are not being marked as completed after docs have been signed and completed. This isn't happening on the workspace dashboard, only on the My Dashboard." -- Matt

...

Screenshot (whole screen, circle relevant area)

image

...

How do we Reproduce it?

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Is the OS or Browser relevant?

Desktop

Smartphone (please complete the following information):

wmerfalen commented 2 years ago

  async function rGetRoot(req, res) {
    let user_id = req.user.user_id;
    let qryParams = Object.assign({ state: 'incomplete' }, req.query);

    let qry = Recommendation.query()
      .where(function (builder) {
        return (
          builder
            // match partners or users
            .where(qryParams)
            .andWhere('partner_id', 'IN', req.user.partners || [])
          //.where({ user_id: user_id })
        );
      })
      .orWhere({ user_id: user_id })
      .withGraphFetched('[account(public), partner(public), user(public), order_block]');

    let [recommendations, meta] = await SharedQuery.handleStandard(qry, req);

    recommendations = recommendations.filter(function (e) {
      return !e.order_block;
    });
    res.result(recommendations, meta);
  }

This is the route function being hit when loading the user's TODO's (recommendations). Notice the orWhere({ user_id: user_id }). I think this is the reason completed items are still popping up here. I think the fix here would be...

.orWhere({user_id: user_id, state: qryParams.state })