mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-09 21:36:44 +08:00
Merge pull request #1536 from jbargu/jg_sci_3100
Missing item smart annotation in Demo project [SCI-3100, 3098]
This commit is contained in:
commit
18c738263d
2 changed files with 39 additions and 28 deletions
|
@ -19,7 +19,8 @@ module DelayedUploaderDemo
|
||||||
current_team:,
|
current_team:,
|
||||||
result_name:,
|
result_name:,
|
||||||
created_at: Time.now,
|
created_at: Time.now,
|
||||||
file_name:
|
file_name:,
|
||||||
|
comment: nil
|
||||||
)
|
)
|
||||||
temp_asset = get_asset(current_user, current_team, file_name)
|
temp_asset = get_asset(current_user, current_team, file_name)
|
||||||
temp_result = Result.new(
|
temp_result = Result.new(
|
||||||
|
@ -32,6 +33,10 @@ module DelayedUploaderDemo
|
||||||
|
|
||||||
temp_result.save
|
temp_result.save
|
||||||
temp_asset.save
|
temp_asset.save
|
||||||
|
|
||||||
|
# Generate comment if it exists
|
||||||
|
generate_result_comment(temp_result, current_user, comment) if comment
|
||||||
|
|
||||||
temp_asset.post_process_file(my_module.experiment.project.team)
|
temp_asset.post_process_file(my_module.experiment.project.team)
|
||||||
|
|
||||||
# Create result activity
|
# Create result activity
|
||||||
|
@ -57,4 +62,25 @@ module DelayedUploaderDemo
|
||||||
step.assets << temp_asset
|
step.assets << temp_asset
|
||||||
temp_asset.post_process_file(step.my_module.experiment.project.team)
|
temp_asset.post_process_file(step.my_module.experiment.project.team)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.generate_result_comment(result, user, message, created_at = nil)
|
||||||
|
created_at ||= result.created_at
|
||||||
|
ResultComment.create(
|
||||||
|
user: user,
|
||||||
|
message: message,
|
||||||
|
created_at: created_at,
|
||||||
|
result: result
|
||||||
|
)
|
||||||
|
Activity.new(
|
||||||
|
type_of: :add_comment_to_result,
|
||||||
|
user: user,
|
||||||
|
project: result.my_module.experiment.project,
|
||||||
|
my_module: result.my_module,
|
||||||
|
created_at: created_at,
|
||||||
|
updated_at: created_at,
|
||||||
|
message: I18n.t('activities.add_comment_to_result',
|
||||||
|
user: user.full_name,
|
||||||
|
result: result.name)
|
||||||
|
).sneaky_save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -798,11 +798,12 @@ module FirstTimeDataGenerator
|
||||||
user: user
|
user: user
|
||||||
)
|
)
|
||||||
qpcr_id = MyModule.where(name: 'qPCR').last.id.base62_encode
|
qpcr_id = MyModule.where(name: 'qPCR').last.id.base62_encode
|
||||||
generate_result_comment(
|
DelayedUploaderDemo.generate_result_comment(
|
||||||
temp_result,
|
temp_result,
|
||||||
user,
|
user,
|
||||||
user_annotation + ' Please check if results match results in ' \
|
user_annotation + ' Please check if results match results in ' \
|
||||||
'[#qPCR~tsk~' + qpcr_id + ']'
|
'[#qPCR~tsk~' + qpcr_id + ']',
|
||||||
|
generate_random_time(temp_result.created_at, 1.days)
|
||||||
)
|
)
|
||||||
temp_result.table = Table.new(
|
temp_result.table = Table.new(
|
||||||
created_by: user,
|
created_by: user,
|
||||||
|
@ -833,7 +834,8 @@ module FirstTimeDataGenerator
|
||||||
current_team: team,
|
current_team: team,
|
||||||
result_name: 'Agarose gel electrophoresis of totRNA samples',
|
result_name: 'Agarose gel electrophoresis of totRNA samples',
|
||||||
created_at: generate_random_time(my_modules[2].created_at, 3.days),
|
created_at: generate_random_time(my_modules[2].created_at, 3.days),
|
||||||
file_name: 'totRNA_gel.jpg'
|
file_name: 'totRNA_gel.jpg',
|
||||||
|
comment: user_annotation + ' Could you check if this is okay?'
|
||||||
)
|
)
|
||||||
|
|
||||||
# ----------------- Module 4 ------------------
|
# ----------------- Module 4 ------------------
|
||||||
|
@ -955,8 +957,8 @@ module FirstTimeDataGenerator
|
||||||
'If desired, more than 30 mg tissue can be disrupted and homogenized ' \
|
'If desired, more than 30 mg tissue can be disrupted and homogenized ' \
|
||||||
'at the start of the procedure (increase the volume of Buffer RLT ' \
|
'at the start of the procedure (increase the volume of Buffer RLT ' \
|
||||||
'proportionately). Use a portion of the homogenate corresponding to no ' \
|
'proportionately). Use a portion of the homogenate corresponding to no ' \
|
||||||
'more than 30 mg tissue for RNA purification, and store the rest at –80',
|
'more than 30 mg tissue for RNA purification, and store the rest at –80°C.',
|
||||||
'°C. Buffer RLT may form a precipitate upon storage. If necessary, ' \
|
'Buffer RLT may form a precipitate upon storage. If necessary, ' \
|
||||||
'redissolve by warming, and then place at room temperature (15–25°C).',
|
'redissolve by warming, and then place at room temperature (15–25°C).',
|
||||||
'Buffer RLT and Buffer RW1 contain a guanidine salt and are therefore ' \
|
'Buffer RLT and Buffer RW1 contain a guanidine salt and are therefore ' \
|
||||||
'not compatible with disinfecting reagents containing bleach. See page ' \
|
'not compatible with disinfecting reagents containing bleach. See page ' \
|
||||||
|
@ -1249,7 +1251,11 @@ module FirstTimeDataGenerator
|
||||||
current_team: team,
|
current_team: team,
|
||||||
result_name: 'Bacteria plates YPGA',
|
result_name: 'Bacteria plates YPGA',
|
||||||
created_at: generate_random_time(my_modules[5].created_at, 2.days),
|
created_at: generate_random_time(my_modules[5].created_at, 2.days),
|
||||||
file_name: 'Bacterial_colonies.jpg'
|
file_name: 'Bacterial_colonies.jpg',
|
||||||
|
comment: user_annotation + ' please check the results again. ' \
|
||||||
|
'<span class=\"atwho-inserted\" contenteditable=\"false\"' \
|
||||||
|
'data-atwho-at-query=\"#\">[#' + fifth_rep_item + ']</span>' \
|
||||||
|
' seems to be acting strange?'
|
||||||
)
|
)
|
||||||
|
|
||||||
DelayedUploaderDemo.delay(queue: asset_queue).generate_result_asset(
|
DelayedUploaderDemo.delay(queue: asset_queue).generate_result_asset(
|
||||||
|
@ -1669,27 +1675,6 @@ module FirstTimeDataGenerator
|
||||||
).sneaky_save
|
).sneaky_save
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_result_comment(result, user, message, created_at = nil)
|
|
||||||
created_at ||= generate_random_time(result.created_at, 1.days)
|
|
||||||
ResultComment.create(
|
|
||||||
user: user,
|
|
||||||
message: message,
|
|
||||||
created_at: created_at,
|
|
||||||
result: result
|
|
||||||
)
|
|
||||||
Activity.new(
|
|
||||||
type_of: :add_comment_to_result,
|
|
||||||
user: user,
|
|
||||||
project: result.my_module.experiment.project,
|
|
||||||
my_module: result.my_module,
|
|
||||||
created_at: created_at,
|
|
||||||
updated_at: created_at,
|
|
||||||
message: I18n.t('activities.add_comment_to_result',
|
|
||||||
user: user.full_name,
|
|
||||||
result: result.name)
|
|
||||||
).sneaky_save
|
|
||||||
end
|
|
||||||
|
|
||||||
def generate_step_comment(step, user, message, created_at = nil)
|
def generate_step_comment(step, user, message, created_at = nil)
|
||||||
created_at ||= generate_random_time(step.created_at, 2.hours)
|
created_at ||= generate_random_time(step.created_at, 2.hours)
|
||||||
StepComment.create(
|
StepComment.create(
|
||||||
|
|
Loading…
Add table
Reference in a new issue