Skip to content

Commit

Permalink
simple growth api
Browse files Browse the repository at this point in the history
  • Loading branch information
qinmingyuan committed Mar 7, 2024
1 parent 6afa7ab commit 8f463fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/growth/controller/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def growth_api(code, entity = nil)

Aim.where(id: aim_ids).map do |aim|
if current_user
aim_user = current_user.aim_users.find_or_initialize_by(aim_id: aim.id, **aim.serial_hash)
aim_user = current_user.aim_users.find_or_create_by(aim_id: aim.id, **aim.serial_hash)
unless aim_user.task_done? && entity
aim_entity = aim_user.aim_entities.find_or_initialize_by(entity_type: entity.class, entity_id: entity.try(:id))
aim_entity.aim_logs.build(aim_id: aim.id)
Expand Down

0 comments on commit 8f463fa

Please sign in to comment.