I wrote a function that activates a batch of cards based on there pan number
The way it works:
→ A user inserts an excel file with a list of card pans that are already in the system plus user details, the system validates the details and update the card with the user details
When the user makes a list of a more than 500 excel entires, the app takes more the 4 minutes to update the cards.
This is the way I’m updating the cards after its extracted
list
|> Enum.map(fn x ->
Ecards.find_by(pan: x.pan)
|> case do
nil -> # flag fail
card ->
Ecards.update(card, firstName: x.firstName, lastName: x.lastName, cardStatus: "activate")
# flag success
end
end)
# count success and failed then display to user
Is there a faster way of updating the cards from the list that meet the criteria?