mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
update function to get clearer debug picture
This commit is contained in:
parent
07f0f039cf
commit
064fe5fbad
@ -321,22 +321,33 @@ namespace controller {
|
|||||||
auto session = cm->getConnection(CONNECTION_MYSQL_LOGIN_SERVER);
|
auto session = cm->getConnection(CONNECTION_MYSQL_LOGIN_SERVER);
|
||||||
Poco::Data::Statement select(session);
|
Poco::Data::Statement select(session);
|
||||||
std::vector<Poco::Tuple<int,Poco::DateTime>> results;
|
std::vector<Poco::Tuple<int,Poco::DateTime>> results;
|
||||||
|
int email_checked = 0;
|
||||||
|
int resend_count = 1;
|
||||||
select << "select u.id, v.created from users as u "
|
select << "select u.id, v.created from users as u "
|
||||||
<< "LEFT JOIN email_opt_in as v ON(u.id = v.user_id) "
|
<< "LEFT JOIN email_opt_in as v ON(u.id = v.user_id) "
|
||||||
<< "where u.email_checked = 0 "
|
<< "where u.email_checked = ? "
|
||||||
<< "AND v.resend_count <= 1", Poco::Data::Keywords::into(results)
|
<< "AND v.resend_count <= ?", Poco::Data::Keywords::use(email_checked), Poco::Data::Keywords::use(resend_count), Poco::Data::Keywords::into(results)
|
||||||
;
|
;
|
||||||
|
int result_count = 0;
|
||||||
try {
|
try {
|
||||||
|
result_count = select.execute();
|
||||||
|
}
|
||||||
|
catch (Poco::Exception& ex) {
|
||||||
|
em->addError(new ParamError(function_name, "mysql error by select", ex.displayText().data()));
|
||||||
|
em->sendErrorsAsEmail();
|
||||||
|
//return -1;
|
||||||
|
}
|
||||||
|
printf("result_count: %d\n", result_count);
|
||||||
|
if (result_count > 0) {
|
||||||
auto now = Poco::DateTime();
|
auto now = Poco::DateTime();
|
||||||
select.execute();
|
|
||||||
int count_scheduled_at_once = 0;
|
int count_scheduled_at_once = 0;
|
||||||
int count_scheduled = 0;
|
int count_scheduled = 0;
|
||||||
|
|
||||||
for (auto it = results.begin(); it != results.end(); it++) {
|
for (auto it = results.begin(); it != results.end(); it++) {
|
||||||
auto user_id = it->get<0>();
|
auto user_id = it->get<0>();
|
||||||
auto created = it->get<1>();
|
auto created = it->get<1>();
|
||||||
|
|
||||||
auto age = now - created;
|
auto age = now - created;
|
||||||
// older than 7 days, schedule at once
|
// older than 7 days, schedule at once
|
||||||
if (age.days() > 7) {
|
if (age.days() > 7) {
|
||||||
@ -351,13 +362,8 @@ namespace controller {
|
|||||||
count_scheduled++;
|
count_scheduled++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(count_scheduled_at_once) printf("scheduled %d verification email resend at once\n", count_scheduled_at_once);
|
if (count_scheduled_at_once) printf("scheduled %d verification email resend at once\n", count_scheduled_at_once);
|
||||||
if(count_scheduled) printf("scheduled %d verification email resend in the next 7 days\n", count_scheduled);
|
if (count_scheduled) printf("scheduled %d verification email resend in the next 7 days\n", count_scheduled);
|
||||||
}
|
|
||||||
catch (Poco::Exception& ex) {
|
|
||||||
em->addError(new ParamError(function_name, "mysql error by select", ex.displayText().data()));
|
|
||||||
em->sendErrorsAsEmail();
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user