Class: Lazylead::Task::Due
- Inherits:
-
Object
- Object
- Lazylead::Task::Due
- Defined in:
- lib/lazylead/task/micromanager.rb
Overview
Instance of “Due” history item for the particular ticket.
Instance Attribute Summary collapse
-
#issue ⇒ Object
readonly
Returns the value of attribute issue.
-
#when ⇒ Object
readonly
Returns the value of attribute when.
Instance Method Summary collapse
-
#illegal? ⇒ Boolean
Gives true when last change of “Due Date” field was done by not authorized person.
-
#initialize(issue, allowed, since) ⇒ Due
constructor
A new instance of Due.
-
#last ⇒ Object
Detect details about last change of “Due Date” to non-null value.
-
#obsolete? ⇒ Boolean
Give true when “Due Date” changes happens in past and its alert already sent.
Constructor Details
#initialize(issue, allowed, since) ⇒ Due
Returns a new instance of Due.
75 76 77 78 79 |
# File 'lib/lazylead/task/micromanager.rb', line 75 def initialize(issue, allowed, since) @issue = issue @allowed = allowed @since = since end |
Instance Attribute Details
#issue ⇒ Object (readonly)
Returns the value of attribute issue.
73 74 75 |
# File 'lib/lazylead/task/micromanager.rb', line 73 def issue @issue end |
#when ⇒ Object (readonly)
Returns the value of attribute when.
73 74 75 |
# File 'lib/lazylead/task/micromanager.rb', line 73 def when @when end |
Instance Method Details
#illegal? ⇒ Boolean
Gives true when last change of “Due Date” field was done
by not authorized person.
83 84 85 86 |
# File 'lib/lazylead/task/micromanager.rb', line 83 def illegal? return false if @issue.assignee.id.eql?(last.id) @allowed.none? { |a| a.eql? last.id } end |
#last ⇒ Object
Detect details about last change of “Due Date” to non-null value
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/lazylead/task/micromanager.rb', line 94 def last @last ||= begin dd = @issue.history .reverse .find { |h| h["items"].any? { |i| i["field"] == "duedate" } } if dd.nil? && !@issue.duedate.nil? @when = @issue["created"] dd = @issue.reporter else @when = dd["created"] dd = Lazylead::User.new(dd["author"]) end dd end end |
#obsolete? ⇒ Boolean
Give true when “Due Date” changes happens in past and its alert already sent.
89 90 91 |
# File 'lib/lazylead/task/micromanager.rb', line 89 def obsolete? @when < @since end |