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

Archive data in db:seed needed #70

Open
anantshri opened this issue Feb 6, 2021 · 2 comments
Open

Archive data in db:seed needed #70

anantshri opened this issue Feb 6, 2021 · 2 comments

Comments

@anantshri
Copy link
Member

We need to have some past events in dummy db so that past event related bug could be visualized.

Right now both dev and admin interface wont let me move dates back.

@sunilkr
Copy link
Collaborator

sunilkr commented Apr 2, 2021

After fighting with seed.rb for a while, I realized that there is a time validator in Event model which prevents events being created in past.

def time_validator
errors.add(:start_time, 'cannot be nil') if self.start_time.nil?
errors.add(:end_time, 'cannot be nil') if self.end_time.nil?
errors.add(:start_time, 'cannot be in the past') if self.start_time && (self.start_time < Time.now)
errors.add(:end_time, 'cannot be before start time') if (self.start_time && self.end_time) and (self.end_time < self.start_time)
end

Only way I think past this is to add a flag in the model like past_event: false, but don't know how to limit that in dev environment only.

@abhisek suggestions?

@abhisek
Copy link
Member

abhisek commented Apr 2, 2021 via email

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

3 participants