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

[WIP] Check timestamps before overwriting them #24

Merged
merged 1 commit into from Apr 26, 2016

Conversation

anarosas
Copy link
Collaborator

@anarosas anarosas commented Apr 25, 2016

Some of timestamps (started_at) are overwritten during the finish state. Mainly because a new timestamp is passed on the attributes.
We should validate first that we really want to accept these new timestamp by comparing the key name to the target_state or checking if the current key is for the finished_at attribute

obj.state = target_state(data)
end

def set_attr(obj, key, value)
obj.send(:"#{key}=", value) if obj.respond_to?(:"#{key}=")
end

def set_timestamp?(key, target_state_attr)
key == target_state_attr || key == "finished_at" || !key.end_with?('at')
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this condition (key == "finished_at") be more generic ?

@svenfuchs svenfuchs merged commit 776381f into master Apr 26, 2016
@svenfuchs
Copy link
Owner

\o/

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

Successfully merging this pull request may close these issues.

None yet

2 participants