topcoder-platform / micro-frontends-challenges-app

0 stars 12 forks source link

Taas payments in Past Challenges #320

Open SathyaJayabal opened 2 years ago

SathyaJayabal commented 2 years ago

In the community app, the list of past challenges does not include other user's taas payments. The example api call used here is below and it does return the taas payments, but this seems to be filtered out in the FE and not shown on the listings page. https://api.topcoder.com/v5/challenges/?search=taas&startDateEnd=2021-12-07T23%3A59%3A59.999Z&endDateStart=2021-11-07T00%3A00%3A00.000Z&status=Completed&perPage=10&page=1&sortBy=startDate&sortOrder=desc&tracks[]=Dev&tracks[]=Des&tracks[]=DS&tracks[]=QA&types[]=CH&types[]=F2F&types[]=TSK

In the MFE the list includes past payments. The api call used here is the below and we display all the results without any filtering out. https://api.topcoder.com/v5/challenges/?page=1&perPage=10&types[]=CH&types[]=F2F&types[]=TSK&tracks[]=DES&tracks[]=DEV&tracks[]=DS&tracks[]=QA&search=taas&status=Completed&startDateEnd=2021-12-07T18:29:59.999Z&endDateStart=2021-11-06T18:30:00.000Z&sortBy=updated&sortOrder=desc&totalPrizesFrom=0&totalPrizesTo=10000&isLightweight=true

expected: both the listings pages must be consistent

SathyaJayabal commented 2 years ago

https://github.com/topcoder-platform/community-app/blob/50d2fbf2b5c8fa6810ca63e708d1e563e7af690d/src/shared/components/challenge-listing/Listing/Bucket/index.jsx#L79-L89 We are filtering out other user's tasks on the FE on community app. We should do the same here.

cc @lakshmiathreya

luizrrodrigues commented 2 years ago

@SathyaJayabal @lakshmiathreya

I think this need be fixed in API side, members should not see other members TaaS payments and a filter like existing in CA not "safe", because data still available in API response.

So basically this logical need be moved to API:

  let filteredChallenges = sortedChallenges;
  filteredChallenges = sortedChallenges.filter((ch) => {
    if (ch.type === 'Task'
        && ch.task
        && ch.task.isTask
        && ch.task.isAssigned
        && Number(ch.task.memberId) !== Number(userId)) {
      return null;
    }
    return ch;
  });