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

feat: add survey schedule option #2386

Merged
merged 13 commits into from
Apr 8, 2024
Merged

Conversation

mattinannt
Copy link
Member

What does this PR do?

This PR adds the option to schedule a survey for a later so it gets published on the provided date automatically.
Screenshot 2024-04-03 at 18 05 59

Fixes # (issue)

How should this be tested?

  • Create a new survey and set the new scheduling option in the response settings
  • Once published, the survey should have the status scheduled.
  • Change the runOnDate field in the survey manually to date in the past using prisma studio
  • Run the cron job by calling the /api/cron/survey-status endpoint with a valid cron secret
curl --location --request POST 'http://localhost:3000/api/cron/survey-status' \
--header 'X-Api-Key: MY_SECRET'
  • The survey should now be published

Copy link

vercel bot commented Apr 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
formbricks-cloud ⬜️ Ignored (Inspect) Visit Preview Apr 8, 2024 9:32am
formbricks-com ⬜️ Ignored (Inspect) Visit Preview Apr 8, 2024 9:32am

Copy link
Contributor

github-actions bot commented Apr 3, 2024

Thank you for following the naming conventions for pull request titles! 🙏

Copy link
Member

@jobenjada jobenjada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UI looks great! Didn't test the functionality so @gupta-piyush19 pls do so before merging :)

Copy link
Contributor

@gupta-piyush19 gupta-piyush19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @mattinannt, for the feature; it works really well 🚀 
I just have a few suggestions related to code consistency; it would be great if you could comment on or fix them. 
Also, one more question: If a survey is already completed and I try to set the runOnDate, should it move to scheduled status or not? Currently, it's not.

apps/web/app/api/cron/survey-status/route.ts Outdated Show resolved Hide resolved
.github/workflows/cron-closeOnDate.yml Outdated Show resolved Hide resolved
docker/cronjobs Outdated Show resolved Hide resolved
@mattinannt
Copy link
Member Author

@gupta-piyush19 Thanks for the review; I made the required changes; please take a look 😊

@gupta-piyush19 gupta-piyush19 added this pull request to the merge queue Apr 8, 2024
Merged via the queue into main with commit 08ce026 Apr 8, 2024
10 of 12 checks passed
@gupta-piyush19 gupta-piyush19 deleted the feature/schedule-survey branch April 8, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants