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

Resetting Sequence #132

Open
whoisstan opened this issue Jul 5, 2018 · 1 comment
Open

Resetting Sequence #132

whoisstan opened this issue Jul 5, 2018 · 1 comment

Comments

@whoisstan
Copy link

Hi,
I have a factory that defines a property like this:

duration: Factory.sequence(function(n) { return n }),

I create multiple sets of objects

await factory.createManyAsync('object', 200 )
await factory.createManyAsync('object', 200,{ref:hardcoded_id} )

Now for the second set I like the duration sequence to start from the beginning again, how can I do that? I that possible?

Best,
Stan

@whoisstan
Copy link
Author

Solved it this way, the name of specific sequence 'createdAtSequence' can be passed in via buildOptions.

...
createdAt: factory.sequence(buildOptions.createdAtSequence||'createdAt', n=>
{ return moment().add(parseInt((n-1)/buildOptions.per_day||100),'days').toDate() }
)
...

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

No branches or pull requests

1 participant