I'm trying to make a formula in my project.rb model in my rails 4 app.
I have an attribute in an preference table, called delay. I want to calculate whether the tolerance on one user's part, is close to the delay required by another user.
In my project.rb, I've tried to do this as follows:
def publication_delay_variance
if @current_user.profile.organisation.preference.delay >= @project.profile.organisation.preference.delay
'No problems here'
elsif @current_user.profile.organisation.preference.delay * 90% >= @project.profile.organisation.preference.delay
"Close, but not quite there"
else @current_user.profile.organisation.preference.delay * 50% >= @project.profile.organisation.preference.delay
"We're not in alignment here"
end
end
the current user is the current user who is currently logged in and interacting with the page. The other user is the user who created the project. Each user has an organisation. Each organisation has preferences. I'm trying to compare them.
Can anyone see what I'm doing wrong? I don't have much experience with this. My current attempt generates this error:
syntax error, unexpected >=
...ence.publication_delay * 90% >= @project.profile.organisatio...
..