Skip to content

[$75] Search by date filter #4984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SathyaJayabal opened this issue Sep 22, 2020 · 31 comments
Closed

[$75] Search by date filter #4984

SathyaJayabal opened this issue Sep 22, 2020 · 31 comments

Comments

@SathyaJayabal
Copy link
Collaborator

The current implementation, returns all challenges that are active within the specified date ranges.
But the new implementation does not return these challenges. Not sure how the new search works, it does not even return challenges which have the start date with the specified date range.

Please compare results with prod.
Screenshot 2020-09-22 at 11 05 44 AM
Screenshot 2020-09-22 at 11 05 48 AM
Screenshot 2020-09-22 at 11 10 23 AM
Screenshot 2020-09-22 at 11 10 30 AM

@SathyaJayabal SathyaJayabal added P2 Important (resolve within 3 days) listing:re-implementation labels Sep 22, 2020
@Oanh-and-only-Oanh Oanh-and-only-Oanh changed the title Search by date filter [$75] Search by date filter Sep 22, 2020
@crazyk07
Copy link

Contest https://www.topcoder.com/challenges/30143204 has been created for this ticket.

This is an automated message for crazyk via Topcoder X

@luizrrodrigues
Copy link
Collaborator

@topcoder-platform/topcodercompetitors @topcoder-platform/tcxcommunity this is open for pickup

Submit in 8 hours and PR to

https://github.com/topcoder-platform/community-app/tree/feature-refactor-challengelist
https://github.com/topcoder-platform/topcoder-react-lib/tree/feature-refactor-challengelist

run npm run test before PR

@crazyk07
Copy link

Contest https://www.topcoder.com/challenges/30143204 has been updated - it has been assigned to cagdas001.

This is an automated message for crazyk via Topcoder X

@cagdas001
Copy link
Collaborator

cagdas001 commented Sep 23, 2020

@luizrrodrigues @SathyaJayabal can't reproduce. It shows same challenges with prod. Please check if it's still an issue

Staging Prod
chrome_2020-09-23_15-55-06 chrome_2020-09-23_15-55-24

@cagdas001 cagdas001 added the Need clarification Need clarification to proceed fixing the issue further label Sep 23, 2020
@SathyaJayabal
Copy link
Collaborator Author

@cagdas001 , please use test env, Staging is in use for another testing.

@cagdas001
Copy link
Collaborator

@cagdas001 , please use test env, Staging is in use for another testing.

What's the url of test env? I had checked the network tab with staging and it was calling the backend to apply filter, as expected

@luizrrodrigues
Copy link
Collaborator

@cagdas001
Copy link
Collaborator

I guess I've been banned:
2020-09-23_17-23-21

@luizrrodrigues
Copy link
Collaborator

@cagdas001
Copy link
Collaborator

@cagdas001 Try access challenges: https://test-community-app.topcoder-dev.com/challenges

Yes I can access the test-community-app, but tried to access topcoder-dev.com to compare results

@luizrrodrigues
Copy link
Collaborator

@cagdas001 Ah sorry, no able to access challenges directly? https://www.topcoder-dev.com/challenges

@cagdas001
Copy link
Collaborator

@cagdas001 Ah sorry, no able to access challenges directly? https://www.topcoder-dev.com/challenges

That wasnt working either, but looks like the issue has gone away now. Its working

@SathyaJayabal
Copy link
Collaborator Author

@cagdas001 , you can use qa env for comparison
https://qa-community-app.topcoder-dev.com/challenges

@cagdas001
Copy link
Collaborator

@luizrrodrigues

  1. First of all, since you're using the current prod env to compare/validate results, I need to note/clarify this. I'm not sure if even the current prod filtering is correct. The prod currently uses these functions from topcoder-react-lib, for date range filter:
function filterByStartDate(challenge, state) {
  if (!state.startDate) return true;
  const submissionPhase = (challenge.phases || []).filter(d => d.name === 'Submission')[0];
  const submissionEndDate = submissionPhase ? submissionPhase.scheduledEndDate
    : challenge.submissionEndDate;
  return moment(state.startDate).isBefore(submissionEndDate);
}


function filterByEndDate(challenge, state) {
  if (!state.endDate) return true;
  const registrationPhase = (challenge.phases || []).filter(d => d.name === 'Registration')[0];
  const registrationStartDate = registrationPhase ? registrationPhase.scheduledStartDate
    : challenge.registrationStartDate;
  return moment(state.endDate).isAfter(registrationStartDate);
}

For end date filter, it checks if the end date is greater than the registration start date
For start date filter, it checks if the submission end date is greater than the start date.

Shouldn't it be the opposite?

For end date filter, it should check if the end date is greater than the submission end date
For start date filter, it should check if the registration start date is greater than the start date

  1. The current API call for date range filter uses ?startDateStart=...&endDateEnd=... query parameters. These mean challenge.startDate & challenge.endDate But, as far as I understand from the previous implementation (above), you're treating the registration start date as startDate and submission end date as endDate. (which makes sense from the point of view of an end user) So the new API call will use ?registrationStartDateStart=...&submissionEndDateEnd=... query params instead.
  2. As discussed before too, V5 Challenge API has some issues with these date fields. So getting the API fixed before proceeding in this one will be better otherwise QA team won't be able to validate the results as it will return wrong challenges

@SathyaJayabal
Copy link
Collaborator Author

@cagdas001 the current implementation is correct. If you see, it will return all challenges that were active (and the submission phase was open) during the time period selected.

For end date filter, it checks if the end date is greater than the registration start date - we want to make sure the registration started before the selected end date

For start date filter, it checks if the submission end date is greater than the start date.- make sure submission phase has not ended before the selected start date

@SathyaJayabal
Copy link
Collaborator Author

@cagdas001 , can you create an issue on the challenge api repo for the dates fields issue, with examples please?

https://github.com/topcoder-platform/challenge-api/issues

@luizrrodrigues
Copy link
Collaborator

@cagdas001 I think this filter will works:

https://api.topcoder-dev.com/v5/challenges/?endDateStart=2020-10-01T00%3A00%3A00Z&startDateEnd=2020-10-03T00%3A00%3A00Z&status=Active&currentPhaseName=Submission

endDateStart: 2020-10-01T00:00:00Z
startDateEnd: 2020-10-03T00:00:00Z
status: Active
currentPhaseName: Submission

image

@luizrrodrigues luizrrodrigues removed the Need clarification Need clarification to proceed fixing the issue further label Oct 2, 2020
@cagdas001
Copy link
Collaborator

@luizrrodrigues We should use registrationStartDateStart and submissionEndDateEnd instead of startDate and endDate See the 2. point of this comment #4984 (comment)

So I'll implement & fix this feature with the assumption of API is working properly?

cagdas001 added a commit to cagdas001/community-app that referenced this issue Oct 2, 2020
* The date filters at challenge listing page was using `startDateStart`
and `endDateEnd` query parameters for `GET /challenges` call.
* It now uses `registrationStartDateStart` and `submissionEndDateEnd`
instead, in  compliance with previous implementation.

Addresses topcoder-platform#4984
@cagdas001
Copy link
Collaborator

Your request (startDate & endDate) is not the V4 implementation. The current changes already follow the V4. Please read comments

@luizrrodrigues
Copy link
Collaborator

@cagdas001 I read all comments. What I said here is, your implementation, search results no match with v4 results (please compare your solution with https://beta-community-app.topcoder.com/challenges

@cagdas001
Copy link
Collaborator

Yeah because beta still uses frontend filters while you migrated sorting & filtering to backend with challenge listing revamp. That's what I meant by

If you notice any defect (missing/wrong challenges etc), you first check the endpoint with these params it it's working properly

Check the frontend filtering implementation above, you'll see API call uses correct field names

@Oanh-and-only-Oanh Oanh-and-only-Oanh added P1 Urgent (resolve within 24 hours) and removed tcx_Feedback labels Oct 7, 2020
cagdas001 added a commit to cagdas001/community-app that referenced this issue Oct 8, 2020
* The date filters at challenge listing page was using
`startDateStart` (start date) and `endDateEnd` (end date)
query parameters for `GET /challenges` call.
* It now uses `startDateEnd` (end date) and `endDateStart` (start date)
instead, in  compliance with previous implementation.

Addresses topcoder-platform#4984
@cagdas001
Copy link
Collaborator

Updated the PR as per the discussion with @luizrrodrigues on Slack

@luizrrodrigues
Copy link
Collaborator

@SathyaJayabal Ping me on Slack before QA this one.

@SathyaJayabal
Copy link
Collaborator Author

verified on staging.
Search results return all challenges that were active within the selected time period.
Screenshot 2020-10-08 at 9 54 14 AM

@luizrrodrigues
Copy link
Collaborator

This ticket was not processed for payment. If you would like to process it for payment, please reopen it, add the tcx_FixAccepted label, and then close it again

This is an automated message for luizrrodrigues via Topcoder X

@luizrrodrigues
Copy link
Collaborator

Payment task has been updated: https://software.topcoder.com/review/actions/ViewProjectDetails?pid=30143204

This is an automated message for luizrrodrigues via Topcoder X

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants