Skip to content

Commit

Permalink
fix: campaign status with error where does not has phone number
Browse files Browse the repository at this point in the history
  • Loading branch information
clairton committed Sep 18, 2024
1 parent cf6ce32 commit 01ac5a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ export default {
>
{{ campaignReport }}
</div>
<div
v-if="campaign.inbox.channel_type == 'Channel::Whatsapp'"
class="mb-1 text-xs text-slate-700 dark:text-slate-500"
>
{{ campaign.audience .filter(a => a.status == 'error') .map(a =>
`${a.name} : ${a.phone_number} <br />`) }}
</div>
</div>
</div>
</template>
4 changes: 2 additions & 2 deletions app/services/whatsapp/oneoff_unoapi_campaign_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def process_audience(audience)
interval = 0
new_audience = audience.map do |a|
aa = update_audience(a)
interval = schedule_job(campaign, aa, interval)
interval = schedule_job(campaign, aa, interval) if aa[:status] == :scheduled
aa
end
# rubocop:disable Rails/SkipsModelValidations
Expand All @@ -30,7 +30,7 @@ def process_audience(audience)
end

def update_audience(audience)
audience[:status] = :scheduled
audience[:status] = audience[:phone_number].present? ? :scheduled : :error
audience[:audience_id] = SecureRandom.uuid
audience.symbolize_keys
end
Expand Down

0 comments on commit 01ac5a5

Please sign in to comment.