0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

Fix merge issues

Dieser Commit ist enthalten in:
angusmcleod 2021-09-01 10:46:52 +08:00
Ursprung 001d116298
Commit 0e5fc756df

Datei anzeigen

@ -45,7 +45,7 @@ class CustomWizard::Submission
validate validate
submission_list = self.class.list(wizard, user_id: user.id) submission_list = self.class.list(wizard, user_id: user.id)
submissions = submission_list.select { |submission| submission.id != self.id } submissions = submission_list.submissions.select { |submission| submission.id != self.id }
self.updated_at = Time.now.iso8601 self.updated_at = Time.now.iso8601
submissions.push(self) submissions.push(self)
@ -112,7 +112,7 @@ class CustomWizard::Submission
def self.cleanup_incomplete_submissions(wizard) def self.cleanup_incomplete_submissions(wizard)
user_id = wizard.user.id user_id = wizard.user.id
all_submissions = list(wizard, user_id: user_id) all_submissions = list(wizard, user_id: user_id)
sorted_submissions = all_submissions.sort_by do |submission| sorted_submissions = all_submissions.submissions.sort_by do |submission|
zero_epoch_time = DateTime.strptime("0", '%s') zero_epoch_time = DateTime.strptime("0", '%s')
[ [
submission.submitted_at ? Time.iso8601(submission.submitted_at) : zero_epoch_time, submission.submitted_at ? Time.iso8601(submission.submitted_at) : zero_epoch_time,
@ -132,7 +132,7 @@ class CustomWizard::Submission
PluginStore.set("#{wizard.id}_#{KEY}", user_id, valid_data) PluginStore.set("#{wizard.id}_#{KEY}", user_id, valid_data)
end end
def self.list(wizard, user_id: nil, order_by: nil) def self.list(wizard, user_id: nil, order_by: nil, page: nil)
params = { plugin_name: "#{wizard.id}_#{KEY}" } params = { plugin_name: "#{wizard.id}_#{KEY}" }
params[:key] = user_id if user_id.present? params[:key] = user_id if user_id.present?