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

Add cooldown time #78

Closed
bragovo opened this issue Aug 8, 2018 · 3 comments
Closed

Add cooldown time #78

bragovo opened this issue Aug 8, 2018 · 3 comments

Comments

@bragovo
Copy link

bragovo commented Aug 8, 2018

Is it possible to add next feature? I set time since last updated time when last version will be overwrite without creating a new version. When time is out: new version will be created like current behavior. It will be good for autosaving.

@charlie-wasp
Copy link
Collaborator

Hi @bragovo! I am afraid, I don't understand clearly, what you want to achieve. Can you please provide a snippet with desired API usage example and comments about expected results?

@bragovo
Copy link
Author

bragovo commented Aug 9, 2018

Yeah, sorry for chaos.

# Something like -- rails g logidze:model Post --cooldown=5.minutes
# Find old yesterday record
post = Post.find(27) # v1

# Create new version at 13:01
post.update(title: 'title 1') # v2

# Rewrite v2 at 13:02
post.update(title: 'title 2') #v2

# Rewrite v2 at 13:03
post.update(title: 'title 3') #v2

# Create new version at 13:09
post.update(title: 'title 4') #v3

It will be similar to:

if post.updated_at + 5.minutes < Time.now
  Post.update(title: 'new title')
else
  Post.without_logging { Post.update(title: 'new title') }
end

@zocoi
Copy link
Contributor

zocoi commented Sep 25, 2018

Hi all, just noticed this issue, I added a PR which is very close to this discussion: #87

@bragovo bragovo closed this as completed Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants