decidim-budgets 0.26.0 → 0.27.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/budgets/budget_list_item/show.erb +4 -4
  3. data/app/cells/decidim/budgets/budgets_list/show.erb +2 -2
  4. data/app/cells/decidim/budgets/budgets_list/voted.erb +1 -1
  5. data/app/cells/decidim/budgets/order_activity_cell.rb +29 -0
  6. data/app/cells/decidim/budgets/project_list_item/project_text.erb +2 -2
  7. data/app/cells/decidim/budgets/project_list_item_cell.rb +1 -1
  8. data/app/commands/decidim/budgets/add_line_item.rb +4 -2
  9. data/app/commands/decidim/budgets/admin/create_budget.rb +1 -1
  10. data/app/commands/decidim/budgets/admin/create_order_reminders.rb +66 -0
  11. data/app/commands/decidim/budgets/admin/create_project.rb +5 -2
  12. data/app/commands/decidim/budgets/admin/destroy_budget.rb +1 -1
  13. data/app/commands/decidim/budgets/admin/destroy_project.rb +1 -1
  14. data/app/commands/decidim/budgets/admin/import_proposals_to_budgets.rb +5 -2
  15. data/app/commands/decidim/budgets/admin/update_budget.rb +1 -1
  16. data/app/commands/decidim/budgets/admin/update_project.rb +5 -2
  17. data/app/commands/decidim/budgets/admin/update_project_category.rb +48 -0
  18. data/app/commands/decidim/budgets/admin/update_project_scope.rb +54 -0
  19. data/app/commands/decidim/budgets/admin/update_project_selection.rb +56 -0
  20. data/app/commands/decidim/budgets/cancel_order.rb +1 -1
  21. data/app/commands/decidim/budgets/checkout.rb +10 -3
  22. data/app/commands/decidim/budgets/remove_line_item.rb +1 -1
  23. data/app/controllers/decidim/budgets/admin/projects_controller.rb +149 -1
  24. data/app/controllers/decidim/budgets/projects_controller.rb +12 -12
  25. data/app/forms/decidim/budgets/admin/budget_form.rb +2 -2
  26. data/app/forms/decidim/budgets/admin/order_reminder_form.rb +75 -0
  27. data/app/forms/decidim/budgets/admin/project_form.rb +19 -3
  28. data/app/helpers/decidim/budgets/admin/project_bulk_actions_helper.rb +20 -0
  29. data/app/helpers/decidim/budgets/projects_helper.rb +29 -0
  30. data/app/jobs/decidim/budgets/send_vote_reminder_job.rb +16 -0
  31. data/app/mailers/decidim/budgets/vote_reminder_mailer.rb +39 -0
  32. data/app/models/decidim/budgets/order.rb +2 -3
  33. data/app/models/decidim/budgets/project.rb +12 -4
  34. data/app/packs/entrypoints/decidim_budgets_admin.js +1 -0
  35. data/app/packs/src/decidim/budgets/admin/projects.js +143 -0
  36. data/app/packs/src/decidim/budgets/exit_handler.js +1 -32
  37. data/app/permissions/decidim/budgets/admin/permissions.rb +8 -3
  38. data/app/queries/decidim/budgets/filtered_projects.rb +1 -1
  39. data/app/serializers/decidim/budgets/{data_portability_budgets_order_serializer.rb → download_your_data_budgets_order_serializer.rb} +2 -2
  40. data/app/services/decidim/budgets/order_reminder_generator.rb +85 -0
  41. data/app/views/decidim/budgets/admin/budgets/index.html.erb +3 -0
  42. data/app/views/decidim/budgets/admin/projects/_bulk-actions.html.erb +13 -0
  43. data/app/views/decidim/budgets/admin/projects/_form.html.erb +6 -0
  44. data/app/views/decidim/budgets/admin/projects/_project-tr.html.erb +50 -0
  45. data/app/views/decidim/budgets/admin/projects/bulk_actions/_change-selected.html.erb +15 -0
  46. data/app/views/decidim/budgets/admin/projects/bulk_actions/_dropdown.html.erb +36 -0
  47. data/app/views/decidim/budgets/admin/projects/bulk_actions/_recategorize.html.erb +15 -0
  48. data/app/views/decidim/budgets/admin/projects/bulk_actions/_scope-change.html.erb +25 -0
  49. data/app/views/decidim/budgets/admin/projects/index.html.erb +6 -54
  50. data/app/views/decidim/budgets/admin/projects/update_attribute.js.erb +26 -0
  51. data/app/views/decidim/budgets/admin/proposals_imports/new.html.erb +3 -3
  52. data/app/views/decidim/budgets/projects/_budget_summary.html.erb +6 -6
  53. data/app/views/decidim/budgets/projects/_filters.html.erb +4 -4
  54. data/app/views/decidim/budgets/projects/index.html.erb +30 -3
  55. data/app/views/decidim/budgets/projects/show.html.erb +7 -2
  56. data/app/views/decidim/budgets/vote_reminder_mailer/vote_reminder.html.erb +21 -0
  57. data/config/assets.rb +2 -1
  58. data/config/locales/am-ET.yml +1 -0
  59. data/config/locales/ar.yml +35 -0
  60. data/config/locales/bg.yml +1 -0
  61. data/config/locales/ca.yml +56 -4
  62. data/config/locales/cs.yml +60 -4
  63. data/config/locales/da.yml +1 -0
  64. data/config/locales/de.yml +61 -4
  65. data/config/locales/el.yml +1 -4
  66. data/config/locales/en.yml +55 -4
  67. data/config/locales/eo.yml +1 -0
  68. data/config/locales/es-MX.yml +52 -3
  69. data/config/locales/es-PY.yml +53 -1
  70. data/config/locales/es.yml +54 -2
  71. data/config/locales/et.yml +1 -0
  72. data/config/locales/eu.yml +1 -4
  73. data/config/locales/fi-plain.yml +56 -4
  74. data/config/locales/fi.yml +56 -4
  75. data/config/locales/fr-CA.yml +52 -1
  76. data/config/locales/fr.yml +53 -2
  77. data/config/locales/ga-IE.yml +1 -0
  78. data/config/locales/gl.yml +10 -0
  79. data/config/locales/hr.yml +1 -0
  80. data/config/locales/hu.yml +19 -0
  81. data/config/locales/id-ID.yml +1 -0
  82. data/config/locales/is-IS.yml +2 -1
  83. data/config/locales/it.yml +1 -4
  84. data/config/locales/ja.yml +51 -4
  85. data/config/locales/ko.yml +1 -0
  86. data/config/locales/lb.yml +1 -5
  87. data/config/locales/lt.yml +1 -0
  88. data/config/locales/lv.yml +1 -0
  89. data/config/locales/mt.yml +1 -0
  90. data/config/locales/nl.yml +1 -4
  91. data/config/locales/no.yml +16 -4
  92. data/config/locales/om-ET.yml +1 -0
  93. data/config/locales/pl.yml +1 -4
  94. data/config/locales/pt-BR.yml +2 -5
  95. data/config/locales/pt.yml +1 -4
  96. data/config/locales/ro-RO.yml +1 -4
  97. data/config/locales/ru.yml +1 -0
  98. data/config/locales/si-LK.yml +1 -0
  99. data/config/locales/sk.yml +1 -0
  100. data/config/locales/sl.yml +1 -0
  101. data/config/locales/so-SO.yml +1 -0
  102. data/config/locales/sr-CS.yml +1 -0
  103. data/config/locales/sv.yml +25 -4
  104. data/config/locales/sw-KE.yml +1 -0
  105. data/config/locales/ti-ER.yml +1 -0
  106. data/config/locales/tr-TR.yml +1 -4
  107. data/config/locales/uk.yml +1 -0
  108. data/config/locales/val-ES.yml +1 -0
  109. data/config/locales/vi.yml +1 -0
  110. data/config/locales/zh-CN.yml +1 -0
  111. data/config/locales/zh-TW.yml +1 -0
  112. data/db/migrate/20200804175222_votes_enabled_to_votes_choices.rb +2 -2
  113. data/db/migrate/20220428072638_add_geolocalization_fields_to_projects.rb +9 -0
  114. data/lib/decidim/budgets/admin_engine.rb +3 -0
  115. data/lib/decidim/budgets/component.rb +6 -5
  116. data/lib/decidim/budgets/engine.rb +17 -0
  117. data/lib/decidim/budgets/test/factories.rb +11 -0
  118. data/lib/decidim/budgets/version.rb +1 -1
  119. metadata +38 -18
  120. data/app/services/decidim/budgets/project_search.rb +0 -45
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28c25beb59bd90ac3e73363c55c78e90cd23d84a0125dbc5390ecde3b8c5465e
4
- data.tar.gz: '09ea7ee2815cf19473205debe2000e41fa65e1740d4aa4090c190e7308cad61d'
3
+ metadata.gz: 3fa531ee417f1965e642ac669891a7ab1705d2a39bbad0fbd20b862d2366887a
4
+ data.tar.gz: 014fee8507d07e68e6dcce958912efac0d6c4264ba08a380a4cc6bf77b95171f
5
5
  SHA512:
6
- metadata.gz: 7fd7089bd0b573b689180dba96d3ba996417f6d1de5932995a85e24a45620b5eb41b8dff0bbe163a408989273701118f96f8a6adc35df86791da95ed560b7486
7
- data.tar.gz: c6c89d9c4533ad312fcacb308290e6719c11e8602b523c5ca0c849d59ada8267ab66fe59473f0b2f09a73ea6411b261ac24989b1bfe6d98c5e117c63a7e55f05
6
+ metadata.gz: 347007356a92385202d42ba9380cab18a1b04122a18477df5b640d54d84daf8b440a0e5c6300b3161d5d69b87b1ba5dc4dd04903be5eb0d7f68eb638df34fe5f
7
+ data.tar.gz: 5174a84a9e0a1c73efb3fd0b94c4a7ed4fc9a176891905e4497adbccc4181af2d924740df96e704666f13f594879f70a8ffa162e39dc4ad0f31e403ee88ca88e
@@ -1,16 +1,16 @@
1
1
  <div class="<%= card_class %> budget-list__item budget-list__item-cell">
2
2
  <div class="budget-list__text flex-horizontal">
3
3
  <%= link_to budget_path(budget), class: link_class do %>
4
- <h5 class="card--list__heading">
4
+ <h3 class="card--list__heading">
5
5
  <%= translated_attribute(title) %>
6
- </h5>
6
+ </h3>
7
7
  <% end %>
8
8
 
9
- <h5>
9
+ <div class="heading5">
10
10
  <strong>
11
11
  <%= budget_to_currency(total_budget) %>
12
12
  </strong>
13
- </h5>
13
+ </div>
14
14
 
15
15
  <%= decidim_sanitize html_truncate(translated_attribute(description), length: 140) %>
16
16
  </div>
@@ -2,9 +2,9 @@
2
2
  <div class="columns medium-7 mediumlarge-8">
3
3
  <% if !voting_finished? && (voted?) %>
4
4
  <div class="section">
5
- <h3 class="section-heading">
5
+ <h2 class="section-heading">
6
6
  <%= t(:my_budgets, scope: i18n_scope) %>
7
- </h3>
7
+ </h2>
8
8
 
9
9
  <%= render :voted %>
10
10
  </div>
@@ -4,7 +4,7 @@
4
4
  <%= t(:voted_on, scope: i18n_scope, links: budgets_link_list(voted)) %>
5
5
  </p>
6
6
 
7
- <div id="voted-budgets" class="card card--list budget-list">
7
+ <div id="voted-budgets-list" class="card card--list budget-list">
8
8
  <% voted.each do |budget| %>
9
9
  <%= cell("decidim/budgets/budget_list_item", budget) %>
10
10
  <% end %>
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Budgets
5
+ # A cell to display when actions happen on an order.
6
+ class OrderActivityCell < ActivityCell
7
+ def title
8
+ I18n.t(
9
+ "decidim.budgets.last_activity.new_vote_at_html",
10
+ link: participatory_space_link
11
+ )
12
+ end
13
+
14
+ def resource_link_path
15
+ resource_locator(budget).path
16
+ end
17
+
18
+ def resource_link_text
19
+ decidim_html_escape(translated_attribute(budget.title))
20
+ end
21
+
22
+ private
23
+
24
+ def budget
25
+ @budget ||= resource.budget
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,11 +1,11 @@
1
1
  <div class="budget-list__text card__text">
2
2
  <div>
3
3
  <%= link_to resource_path, class: "card__link" do %>
4
- <h5 class="card__title budget-list__title">
4
+ <h3 class="card__title budget-list__title">
5
5
  <%= cell("decidim/budgets/project_selected_status", model) %>
6
6
 
7
7
  <%= resource_title %>
8
- </h5>
8
+ </h3>
9
9
  <% end %>
10
10
 
11
11
  <div class="show-for-medium">
@@ -17,7 +17,7 @@ module Decidim
17
17
  private
18
18
 
19
19
  def resource_path
20
- resource_locator([model.budget, model]).path(filter_link_params)
20
+ resource_locator([model.budget, model]).path
21
21
  end
22
22
 
23
23
  def resource_title
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Budgets
5
5
  # A command with all the business to add new line items to orders
6
- class AddLineItem < Rectify::Command
6
+ class AddLineItem < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # order - The current order for the user or nil if it is not created yet.
@@ -23,11 +23,13 @@ module Decidim
23
23
  # Returns nothing.
24
24
  def call
25
25
  transaction do
26
- return broadcast(:invalid) if voting_not_enabled? || order.checked_out? || exceeds_budget?
26
+ raise ActiveRecord::RecordInvalid if voting_not_enabled? || order.checked_out? || exceeds_budget?
27
27
 
28
28
  add_line_item
29
29
  broadcast(:ok, order)
30
30
  end
31
+ rescue ActiveRecord::RecordInvalid
32
+ broadcast(:invalid)
31
33
  end
32
34
 
33
35
  private
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user creates an Budget
7
7
  # from the admin panel.
8
- class CreateBudget < Rectify::Command
8
+ class CreateBudget < Decidim::Command
9
9
  def initialize(form)
10
10
  @form = form
11
11
  end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Budgets
5
+ module Admin
6
+ # This command is executed when admin sends vote reminders.
7
+ class CreateOrderReminders < Decidim::Command
8
+ def initialize(form)
9
+ @form = form
10
+ end
11
+
12
+ def call
13
+ return broadcast(:invalid) if form.invalid?
14
+ return broadcast(:invalid) unless voting_enabled?
15
+ return broadcast(:invalid) if voting_ends_soon?
16
+
17
+ generator.generate_for(current_component, &alternative_refresh_state)
18
+
19
+ broadcast(:ok, generator.reminder_jobs_queued)
20
+ end
21
+
22
+ private
23
+
24
+ attr_reader :form
25
+
26
+ def alternative_refresh_state
27
+ proc do |reminder|
28
+ reminder.records.each do |record|
29
+ next if %w(active pending).exclude? record.state
30
+
31
+ record.state = begin
32
+ if record.remindable.created_at > minimum_time_between_reminders ||
33
+ (reminder.deliveries.present? && reminder.deliveries.last.created_at > minimum_time_between_reminders)
34
+ "pending"
35
+ else
36
+ "active"
37
+ end
38
+ end
39
+ record.save if record.changed?
40
+ end
41
+ end
42
+ end
43
+
44
+ def minimum_time_between_reminders
45
+ form.minimum_interval_between_reminders.ago
46
+ end
47
+
48
+ def generator
49
+ @generator ||= Decidim::Budgets::OrderReminderGenerator.new
50
+ end
51
+
52
+ def current_component
53
+ form.current_component
54
+ end
55
+
56
+ def voting_enabled?
57
+ form.voting_enabled?
58
+ end
59
+
60
+ def voting_ends_soon?
61
+ form.voting_ends_soon?
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user creates a Project from the admin
7
7
  # panel.
8
- class CreateProject < Rectify::Command
8
+ class CreateProject < Decidim::Command
9
9
  include ::Decidim::AttachmentMethods
10
10
  include ::Decidim::GalleryMethods
11
11
 
@@ -44,7 +44,10 @@ module Decidim
44
44
  category: form.category,
45
45
  title: form.title,
46
46
  description: form.description,
47
- budget_amount: form.budget_amount
47
+ budget_amount: form.budget_amount,
48
+ address: form.address,
49
+ latitude: form.latitude,
50
+ longitude: form.longitude
48
51
  }
49
52
 
50
53
  @project = Decidim.traceability.create!(
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user destroys a Budget
7
7
  # from the admin panel.
8
- class DestroyBudget < Rectify::Command
8
+ class DestroyBudget < Decidim::Command
9
9
  def initialize(budget, current_user)
10
10
  @budget = budget
11
11
  @current_user = current_user
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user deletes a Project from the admin
7
7
  # panel.
8
- class DestroyProject < Rectify::Command
8
+ class DestroyProject < Decidim::Command
9
9
  # Initializes an UpdateProject Command.
10
10
  #
11
11
  # project - The current instance of the project to be destroyed.
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # A command with all the business logic when an admin imports proposals from
7
7
  # one component to projects of a budget.
8
- class ImportProposalsToBudgets < Rectify::Command
8
+ class ImportProposalsToBudgets < Decidim::Command
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # form - A form object with the params.
@@ -48,7 +48,10 @@ module Decidim
48
48
  description: original_proposal.body,
49
49
  budget_amount: budget_for(original_proposal),
50
50
  category: original_proposal.category,
51
- scope: original_proposal.scope
51
+ scope: original_proposal.scope,
52
+ address: original_proposal.address,
53
+ latitude: original_proposal.latitude,
54
+ longitude: original_proposal.longitude
52
55
  }
53
56
 
54
57
  @project = Decidim.traceability.create!(
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user updates a Budget
7
7
  # from the admin panel.
8
- class UpdateBudget < Rectify::Command
8
+ class UpdateBudget < Decidim::Command
9
9
  def initialize(form, budget)
10
10
  @form = form
11
11
  @budget = budget
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user changes a Project from the admin
7
7
  # panel.
8
- class UpdateProject < Rectify::Command
8
+ class UpdateProject < Decidim::Command
9
9
  include ::Decidim::AttachmentMethods
10
10
  include ::Decidim::GalleryMethods
11
11
 
@@ -53,7 +53,10 @@ module Decidim
53
53
  title: form.title,
54
54
  description: form.description,
55
55
  budget_amount: form.budget_amount,
56
- selected_at: selected_at
56
+ selected_at: selected_at,
57
+ address: form.address,
58
+ latitude: form.latitude,
59
+ longitude: form.longitude
57
60
  )
58
61
  end
59
62
 
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Budgets
5
+ module Admin
6
+ class UpdateProjectCategory < Decidim::Command
7
+ include TranslatableAttributes
8
+
9
+ # Public: Initializes the command.
10
+ #
11
+ # category_id - the category id to update
12
+ # project_ids - the project ids to update.
13
+ def initialize(category_id, project_ids)
14
+ @category = Decidim::Category.find_by id: category_id
15
+ @project_ids = project_ids
16
+ @response = { category_name: "", successful: [], errored: [] }
17
+ end
18
+
19
+ def call
20
+ return broadcast(:invalid_category) if @category.blank?
21
+ return broadcast(:invalid_project_ids) if @project_ids.blank?
22
+
23
+ @response[:category_name] = @category.translated_name
24
+ Project.where(id: @project_ids).find_each do |project|
25
+ if @category == project.category
26
+ @response[:errored] << translated_attribute(project.title)
27
+ else
28
+ transaction do
29
+ update_project_category project
30
+ end
31
+ @response[:successful] << translated_attribute(project.title)
32
+ end
33
+ end
34
+
35
+ broadcast(:update_projects_category, @response)
36
+ end
37
+
38
+ private
39
+
40
+ def update_project_category(project)
41
+ project.update!(
42
+ category: @category
43
+ )
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Budgets
5
+ module Admin
6
+ class UpdateProjectScope < Decidim::Command
7
+ include TranslatableAttributes
8
+
9
+ # Public: Initializes the command.
10
+ #
11
+ # scope_id - the scope id to update
12
+ # project_ids - the project ids to update.
13
+ def initialize(scope_id, project_ids)
14
+ @scope = ::Decidim::Scope.find_by id: scope_id
15
+ @project_ids = project_ids
16
+ @response = { scope_name: "", successful: [], errored: [] }
17
+ end
18
+
19
+ def call
20
+ return broadcast(:invalid_scope) if @scope.blank?
21
+ return broadcast(:invalid_project_ids) if @project_ids.blank?
22
+
23
+ update_projects_scope
24
+
25
+ broadcast(:update_projects_scope, @response)
26
+ end
27
+
28
+ private
29
+
30
+ attr_reader :scope, :project_ids
31
+
32
+ def update_projects_scope
33
+ @response[:scope_name] = translated_attribute(scope.name, scope.organization)
34
+ ::Decidim::Budgets::Project.where(id: project_ids).find_each do |project|
35
+ if scope == project.scope
36
+ @response[:errored] << translated_attribute(project.title)
37
+ else
38
+ transaction do
39
+ update_project_scope project
40
+ end
41
+ @response[:successful] << translated_attribute(project.title)
42
+ end
43
+ end
44
+ end
45
+
46
+ def update_project_scope(project)
47
+ project.update!(
48
+ scope: scope
49
+ )
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Budgets
5
+ module Admin
6
+ class UpdateProjectSelection < Decidim::Command
7
+ include TranslatableAttributes
8
+
9
+ # Public: Initializes the command.
10
+ #
11
+ # selection - Defines if projects are selected (for implementation)
12
+ # project_ids - the project ids to update.
13
+ def initialize(selection, project_ids)
14
+ @selection = selection
15
+ @project_ids = project_ids
16
+ @response = { selection_name: "", successful: [], errored: [] }
17
+ end
18
+
19
+ def call
20
+ return broadcast(:invalid_selection) if @selection.blank? || [true, false, "true", "false"].exclude?(@selection)
21
+ return broadcast(:invalid_project_ids) if @project_ids.blank?
22
+
23
+ @selection = ActiveModel::Type::Boolean.new.cast(@selection)
24
+
25
+ update_projects_selection
26
+
27
+ broadcast(:update_projects_selection, @response)
28
+ end
29
+
30
+ private
31
+
32
+ attr_reader :selection, :project_ids
33
+
34
+ def update_projects_selection
35
+ ::Decidim::Budgets::Project.where(id: project_ids).find_each do |project|
36
+ if (selection == false && !project.selected?) || (selection && project.selected?)
37
+ @response[:errored] << translated_attribute(project.title)
38
+ else
39
+ transaction do
40
+ update_project_selection project
41
+ end
42
+ @response[:successful] << translated_attribute(project.title)
43
+ end
44
+ end
45
+ end
46
+
47
+ def update_project_selection(project)
48
+ selected_at = selection ? Time.current : nil
49
+ project.update!(
50
+ selected_at: selected_at
51
+ )
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Budgets
5
5
  # A command with all the business to cancel an order.
6
- class CancelOrder < Rectify::Command
6
+ class CancelOrder < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # order - The current order for the user.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Budgets
5
5
  # A command with all the business to checkout.
6
- class Checkout < Rectify::Command
6
+ class Checkout < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # order - The current order for the user.
@@ -32,8 +32,15 @@ module Decidim
32
32
 
33
33
  @order.with_lock do
34
34
  SendOrderSummaryJob.perform_later(@order)
35
- @order.checked_out_at = Time.current
36
- @order.save
35
+
36
+ Decidim.traceability.update!(
37
+ @order,
38
+ @order.user,
39
+ { checked_out_at: Time.current },
40
+ visibility: "private-only"
41
+ )
42
+ rescue ActiveRecord::RecordInvalid
43
+ false
37
44
  end
38
45
  end
39
46
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Budgets
5
5
  # A command with all the business to add remove line items from orders
6
- class RemoveLineItem < Rectify::Command
6
+ class RemoveLineItem < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # order - The current order for the user