Skip to content
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

Add Time-Based Filtering for Workspace Bounty Cards #2320

Conversation

aliraza556
Copy link
Contributor

Describe your changes

Issue ticket number and link: https://community.sphinx.chat/p/csb4dj2tu2rqjmn086qg/assigned/3146/0

Type of change

image

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have tested on Chrome and Firefox
  • I have tested on a mobile device
  • I have provided a screenshot or recording of changes in my PR if there were updates to the frontend

@aliraza556
Copy link
Contributor Author

Hi @humansinstitute Please review this PR.

@aliraza556
Copy link
Contributor Author

aliraza556 commented Jan 2, 2025

@humansinstitute The current unit test has failed, but it is not related to my work.

image

Locally, the test passed successfully, as shown in the attached screenshot.

image

I believe this could be a server-side issue, but I am not entirely sure.

@humansinstitute
Copy link
Contributor

@aliraza556

We just need to be careful around the pseudo code example and accounting for timestamps.

This assumes the updated field works with PostgreSQL's INTERVAL directly, but updated is stored as a UNIX timestamp - so I think we need to correct the SQL for the correct behaivour?

timeFilterQuery = `
    AND (
        (NOT paid AND updated > EXTRACT(EPOCH FROM (NOW() - INTERVAL '4 weeks')))
        OR (paid AND updated > EXTRACT(EPOCH FROM (NOW() - INTERVAL '2 weeks')))
        OR updated IS NULL
    )`

Can you review and fix - let me know if I'm incorrect?

Rest of changes look good - good catch on preserving NULL updated records.

@humansinstitute humansinstitute merged commit f50e33d into stakwork:master Jan 3, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants