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

batch emails only send first 10 #76

Closed
jchartrand opened this issue Nov 15, 2024 · 1 comment · Fixed by #77
Closed

batch emails only send first 10 #76

jchartrand opened this issue Nov 15, 2024 · 1 comment · Fixed by #77
Assignees

Comments

@jchartrand
Copy link
Contributor

Describe the bug
Only the first ten recipients in a batch are sent a claim email.

To Reproduce
Steps to reproduce the behavior:

  1. Create a batch with more than ten credential recipients
  2. Send the batch
  3. Only the first ten are sent

Expected behavior
All recipients in a batch should receive emails

Additional context

The problem is very likely here:

const data = await payload.find({
collection: 'credential', // required
depth: 2,
where: { ...query }, // pass a `where` query here
sort: '-title',
locale: 'en',
});

i.e., this chunk of code that gets the list of credentials for a given batch when sending out the emails:

const data = await payload.find({
        collection: 'credential', // required
        depth: 2,
        where: { ...query }, // pass a `where` query here
        sort: '-title',
        locale: 'en',
    });

It seems likely that the 'find' call uses paging by default, with a default result set of 10 per page. So the 'find' call in the sendBatchEmail endpoint (above) is only dealing with the first ten. It would either have to fetch all pages, or it looks like pagination can possibly be turned off, although the payload docs are version 2 and I think the dashboard payload version might be 1, or some combination of 1 and 2. In any case, here is the page from version 2 of the docs, i.e, the bit about setting pagination=false:

https://payloadcms.com/docs/v2/local-api/overview#local-options-available

@alexfigtree
Copy link
Member

Done and deployed; closing.

@alexfigtree alexfigtree moved this from In Progress to Done (Deployed) in DCC Engineering Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done (Deployed)
Development

Successfully merging a pull request may close this issue.

2 participants