Incomplete Seeding

Fixed the seeding bugs with much help from Michael.
Yes, and this relates to the use of the rand(5): an example user only has
an 80% chance of their order being completed even if they do have a billing
address. I should add, though, that I have not verified this effect.

On Fri, Oct 3, 2014 at 2:53 PM, Michael Alexander <notifications@github.com>
wrote:

> In db/seeds.rb:
>
> > +  u.save
> > +end
> > +
> > +#generate orders
> > +def completion(user)
> > +  user[:default_billing_address] && rand(5) > 0
> > +end
> > +
> > +def placement_date
> > +  rand([Time.now - 12.month, Time.now - 8.month, Time.now - 4.month].sample..Time.now)
> > +end
> > +
> > +(SCALAR*25).times do
> > +  sample_user = User.find(rand(User.count)+1)
> > +  random_addresses = random_user_addresses(sample_user.id)
> > +  completed_order = completion(sample_user)
>
> I tracked this through. In practice, this seems to flag any order complete
> if its owner has a default billing address. Problem: can't someone both
> have completed orders and a shopping cart?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/vikingeducation/viking_store/pull/2/files#r18421577>.
>