KonklaveTtv / VenueSender

0 stars 0 forks source link

[CURL] Progress #31

Open KonklaveTtv opened 1 year ago

KonklaveTtv commented 1 year ago

Currently I have set progress for sendIndividualEmail() like follows:

Top of mail.cpp I have declared counters:

// Global progress counters
static int successfulSends = 0; // Counter for successful email sends
static int successfulCustomSends = 0; // Counter for successful custom email sends
static int successfulTemplateSends = 0; // Counter for successful template sends
int totalEmails;
int totalCustomEmails;
int totalTemplateEmails;

Then simply calc like this for sendIndividualEmail():

    // Update totalEmails dynamically
    totalEmails = selectedVenuesForEmail.size();

    res = curl_easy_perform(curl);
    if (res == 0) { // Check if email was sent successfully
        successfulSends++;
        double progressPercentage = 0.0;
        if (totalEmails != 0) {
            progressPercentage = (static_cast<double>(successfulSends) / totalEmails) * 100;
        }

same for sending template emails:

        // Update totalEmails dynamically
        totalTemplateEmails = emailToTemplate.size();

        res = curl_easy_perform(curl);
        if (res == 0) { // Check if email was sent successfully
            successfulTemplateSends++;
            double progressPercentage = 0.0;
            if (totalTemplateEmails != 0) {
                progressPercentage = (static_cast<double>(successfulTemplateSends) / totalTemplateEmails) * 100;
            }

and this for custom email sending:

            res = curl_easy_perform(curl);
            if (res == 0) { // Check if email was sent successfully
                successfulCustomSends = 1;
                double progressPercentage = 0.0;
                if (totalCustomEmails != 0) {
                    progressPercentage = (static_cast<double>(successfulCustomSends) / totalCustomEmails) * 100;
                }

I need to plumb this up to curlopt progress instead.

KonklaveTtv commented 1 year ago

This should be completed prior to production. For alpha and beta (even production would actually be ok) the current calc against emails we are sending against successful sends works "ok".