Merge pull request #1536 from jbargu/jg_sci_3100

Missing item smart annotation in Demo project [SCI-3100, 3098]
This commit is contained in:
Jure Grabnar 2019-02-28 09:52:28 +01:00 committed by GitHub
commit 18c738263d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 28 deletions

View file

@ -19,7 +19,8 @@ module DelayedUploaderDemo
current_team:,
result_name:,
created_at: Time.now,
file_name:
file_name:,
comment: nil
)
temp_asset = get_asset(current_user, current_team, file_name)
temp_result = Result.new(
@ -32,6 +33,10 @@ module DelayedUploaderDemo
temp_result.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)
# Create result activity
@ -57,4 +62,25 @@ module DelayedUploaderDemo
step.assets << temp_asset
temp_asset.post_process_file(step.my_module.experiment.project.team)
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

View file

@ -798,11 +798,12 @@ module FirstTimeDataGenerator
user: user
)
qpcr_id = MyModule.where(name: 'qPCR').last.id.base62_encode
generate_result_comment(
DelayedUploaderDemo.generate_result_comment(
temp_result,
user,
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(
created_by: user,
@ -833,7 +834,8 @@ module FirstTimeDataGenerator
current_team: team,
result_name: 'Agarose gel electrophoresis of totRNA samples',
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 ------------------
@ -955,8 +957,8 @@ module FirstTimeDataGenerator
'If desired, more than 30 mg tissue can be disrupted and homogenized ' \
'at the start of the procedure (increase the volume of Buffer RLT ' \
'proportionately). Use a portion of the homogenate corresponding to no ' \
'more than 30 mg tissue for RNA purification, and store the rest at 80',
'°C. Buffer RLT may form a precipitate upon storage. If necessary, ' \
'more than 30 mg tissue for RNA purification, and store the rest at 80°C.',
'Buffer RLT may form a precipitate upon storage. If necessary, ' \
'redissolve by warming, and then place at room temperature (1525°C).',
'Buffer RLT and Buffer RW1 contain a guanidine salt and are therefore ' \
'not compatible with disinfecting reagents containing bleach. See page ' \
@ -1249,7 +1251,11 @@ module FirstTimeDataGenerator
current_team: team,
result_name: 'Bacteria plates YPGA',
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(
@ -1669,27 +1675,6 @@ module FirstTimeDataGenerator
).sneaky_save
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)
created_at ||= generate_random_time(step.created_at, 2.hours)
StepComment.create(