mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-20 22:24:09 +01:00
fix #1712. Number of occurrences was not handled correctly
This commit is contained in:
parent
01c4b83101
commit
ee3ba62152
3 changed files with 38 additions and 15 deletions
|
|
@ -69,21 +69,22 @@ module RecurringTodos
|
||||||
|
|
||||||
def filter_generic_attributes(attributes)
|
def filter_generic_attributes(attributes)
|
||||||
return Tracks::AttributeHandler.new(@user, {
|
return Tracks::AttributeHandler.new(@user, {
|
||||||
recurring_period: attributes[:recurring_period],
|
recurring_period: attributes[:recurring_period],
|
||||||
description: attributes[:description],
|
description: attributes[:description],
|
||||||
notes: attributes[:notes],
|
notes: attributes[:notes],
|
||||||
tag_list: tag_list_or_empty_string(attributes),
|
tag_list: tag_list_or_empty_string(attributes),
|
||||||
start_from: attributes[:start_from],
|
start_from: attributes[:start_from],
|
||||||
end_date: attributes[:end_date],
|
end_date: attributes[:end_date],
|
||||||
ends_on: attributes[:ends_on],
|
ends_on: attributes[:ends_on],
|
||||||
target: attributes[:target],
|
number_of_occurences: attributes[:number_of_occurences],
|
||||||
project: attributes[:project],
|
target: attributes[:target],
|
||||||
context: attributes[:context],
|
project: attributes[:project],
|
||||||
project_id: attributes[:project_id],
|
context: attributes[:context],
|
||||||
context_id: attributes[:context_id],
|
project_id: attributes[:project_id],
|
||||||
target: attributes[:recurring_target],
|
context_id: attributes[:context_id],
|
||||||
show_from_delta: attributes[:recurring_show_days_before],
|
target: attributes[:recurring_target],
|
||||||
show_always: attributes[:recurring_show_always]
|
show_from_delta: attributes[:recurring_show_days_before],
|
||||||
|
show_always: attributes[:recurring_show_always]
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,10 @@ module RecurringTodos
|
||||||
get :show_from_delta
|
get :show_from_delta
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def number_of_occurences
|
||||||
|
get :number_of_occurences
|
||||||
|
end
|
||||||
|
|
||||||
def recurring_target_as_text
|
def recurring_target_as_text
|
||||||
target == 'due_date' ? I18n.t("todos.recurrence.pattern.due") : I18n.t("todos.recurrence.pattern.show")
|
target == 'due_date' ? I18n.t("todos.recurrence.pattern.due") : I18n.t("todos.recurrence.pattern.show")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,24 @@ module RecurringTodos
|
||||||
assert pattern.valid?, "should be valid"
|
assert pattern.valid?, "should be valid"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_validation_on_number_of_occurences
|
||||||
|
attributes = {
|
||||||
|
'weekly_return_monday' => 'm', # weekly specific
|
||||||
|
'weekly_every_x_week' => 1,
|
||||||
|
'recurring_show_always' => false,
|
||||||
|
'recurring_show_days_before' => 5,
|
||||||
|
'ends_on' => 'ends_on_number_of_times',
|
||||||
|
}
|
||||||
|
|
||||||
|
# pattern = create_recurring_todo(attributes)
|
||||||
|
# assert !pattern.valid?, "number_of_occurences should be filled"
|
||||||
|
|
||||||
|
attributes['number_of_occurences']=5
|
||||||
|
pattern = create_recurring_todo(attributes)
|
||||||
|
assert pattern.valid?, "should be valid"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def test_end_date_on_recurring_todo
|
def test_end_date_on_recurring_todo
|
||||||
rt = recurring_todos(:call_bill_gates_every_day)
|
rt = recurring_todos(:call_bill_gates_every_day)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue