1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

(bug) unable to update Store Order sub type in statistics

This commit is contained in:
Du Peng 2023-07-06 10:15:05 +02:00
parent 6e014ddfe6
commit bd6e4fe0ab
2 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,8 @@
# Changelog Fab-manager
- Fix a bug: unable to show project step image in markdown file
- Fix a bug: unable to update Store Order sub type in statistics
- [TODO DEPLOY] `rails fablab:maintenance:regenerate_statistics[2014,1]`
## v6.0.8 2023 July 03

View File

@ -45,7 +45,13 @@ class Orders::OrderService
# update in elasticsearch (statistics)
stat_order = Stats::Order.search(query: { term: { orderId: order.id } })
stat_order.map { |s| s.update(state: state) }
sub_type = if state.in?(%w[paid in_progress ready delivered])
'paid-processed'
elsif state.in?(%w[payment_failed refunded canceled])
'aborted'
end
stat_order.map { |s| s.update(subType: sub_type, state: state) } if sub_type.present?
order
end