Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lottery): added lottery system with emails to winners #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tcxcx
Copy link

@tcxcx tcxcx commented Jul 12, 2024

This pull request implements a comprehensive lottery system for POAP drops, which includes the functionality to draw winners and send email notifications to the selected participants. Below is a detailed summary of the work completed:

Key Features and Improvements
Lottery Draw System:

Implemented a method to draw winners from the list of participants in a POAP drop.
Ensured that the lottery draw only takes place if the POAP drop is a lottery and has enough participants.

Email Notifications:

Integrated email functionality to notify the winners of their prize.
Ensured that all winners receive their respective emails by leveraging Promise.all to handle multiple email sending operations concurrently.

User Interface Enhancements:

Improved the user interface to display the lottery winners and their prizes in a clean and organized table format.
Ensured the emails of winners are displayed correctly.

Error Handling and Logging:

Added extensive error handling and logging to capture and debug any issues during the lottery draw and email sending process.
Ensured clear logging of the lottery process, including before and after saving the lottery results and during email notifications.

Code Refactoring and Optimization:

Used utility functions for common tasks such as shuffling arrays and handling asynchronous operations.

Detailed Changes
Lottery Draw Implementation (lottery-draw.ts):

  • Added drawLottery function to handle the lottery draw logic.
  • Populated the POAP drop details and ensured it is a valid lottery.
  • Retrieved the list of participants and randomly selected three winners.
  • Updated the POAP drop with the lottery results and saved it to the database.
  • Implemented logic to send email notifications to all selected winners using SmtpSendTemplate.

User Interface (lottery-winners.vue):

  • Enhanced the UI to display the list of winners and their prizes in a table format.
  • Ensured proper display of emails and prizes in the UI.

Email Template Integration:

  • Added HTML email template for lottery winner notifications (en-lottery-winner.html).
  • Configured the SMTP email sending method to use the correct template and send emails to all winners.

Error Handling and Logging:

  • Added detailed logging for various stages of the lottery process.
  • Implemented error handling to catch and log any issues during the process.

Testing and Validation

  • Manual Testing: Manually tested the lottery draw process and email notifications to ensure functionality.
  • Debugging: Verified logs to ensure all steps in the process are executed correctly and all winners receive their emails.

Future Enhancements

  • Add prize images to be shown alongside the prizes.
  • Make the email contain detailed instructions for redemption of the prize, alongside the prize name.
  • Add a prize page showing the prizes won as the QR page with confetti.
  • Add more robust unit tests to cover edge cases and ensure reliability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant