Skip to content

Commit

Permalink
rake task Restream#16
Browse files Browse the repository at this point in the history
  • Loading branch information
phsin committed Nov 26, 2019
1 parent 845728e commit 0d85993
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
3 changes: 2 additions & 1 deletion app/controllers/digest_rules_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def destroy
end

def show
digest_rule = @user.digest_rules.find(params[:id])
#digest_rule = @user.digest_rules.find(params[:id])
digest_rule = DigestRule.find(params[:id])
@digest = RedmineDigest::Digest.new(digest_rule, Time.now, PREVIEW_ISSUE_LIMIT)
render layout: 'digest'
end
Expand Down
31 changes: 20 additions & 11 deletions lib/tasks/redmine_digest.rake
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,26 @@ namespace :redmine_digest do
User.find_each() do |user|
#puts user.inspect
puts "rule #{count}"
t = DigestRule.new
t.user = user
t.name = "default_digest_1"
t.active =true
t.recurrent = DigestRule::DAILY
t.project_selector = DigestRule::MEMBER
t.event_ids = DigestEvent::TYPES
t.notify = DigestRule::DIGEST_ONLY
t.template = DigestRule::TEMPLATE_SHORT
t.save!
# puts t.inspect
t = user.digest_rules.create(
name: 'test',
notify: DigestRule::DIGEST_ONLY,
recurrent: DigestRule::MONTHLY,
project_selector: DigestRule::ALL,
event_ids: %w(issue_created project_changed subject_changed assignee_changed status_changed percent_changed version_changed other_attr_changed attachment_added description_changed comment_added),
# event_ids: DigestEvent::TYPES
)

# t = DigestRule.new
# t.user = user
# t.name = "default_digest_1"
# t.active =true
# t.recurrent = DigestRule::DAILY
# t.project_selector = DigestRule::MEMBER
# t.event_ids = DigestEvent::TYPES
# t.notify = DigestRule::DIGEST_ONLY
# t.template = DigestRule::TEMPLATE_SHORT
# t.save!
puts t.inspect
count=count+1
end
puts "Created #{count} digest rules"
Expand Down

0 comments on commit 0d85993

Please sign in to comment.