Fossil SCM

Take the email-renew-cutoff into account when computing the number of active subscribers.

drh 2021-05-31 23:31 time-limited-subscriptions
Commit fc10e775e92713db167679078b16ab15937052b41535d845a5b6d5b6b7ed40c5
1 file changed +4 -1
+4 -1
--- src/stat.c
+++ src/stat.c
@@ -59,10 +59,11 @@
5959
*/
6060
void stats_for_email(void){
6161
const char *zDest = db_get("email-send-method",0);
6262
int nSub, nASub, nPend, nDPend;
6363
const char *zDir, *zDb, *zCmd, *zRelay;
64
+ int iCutoff;
6465
@ <tr><th>Outgoing&nbsp;Email:</th><td>
6566
if( fossil_strcmp(zDest,"pipe")==0
6667
&& (zCmd = db_get("email-send-command",0))!=0
6768
){
6869
@ Piped to command "%h(zCmd)"
@@ -110,12 +111,14 @@
110111
@ <tr><th><a href="%R/subscribers">Subscribers:</a></th><td>
111112
}else{
112113
@ <tr><th>Subscribers:</th><td>
113114
}
114115
nSub = db_int(0, "SELECT count(*) FROM subscriber");
116
+ iCutoff = db_get_int("email-renew-cutoff",0);
115117
nASub = db_int(0, "SELECT count(*) FROM subscriber WHERE sverified"
116
- " AND NOT sdonotcall AND length(ssub)>1");
118
+ " AND NOT sdonotcall AND length(ssub)>1"
119
+ " AND lastContact>=%d;", iCutoff);
117120
@ %,d(nASub) active, %,d(nSub) total
118121
@ </td></tr>
119122
}
120123
121124
/*
122125
--- src/stat.c
+++ src/stat.c
@@ -59,10 +59,11 @@
59 */
60 void stats_for_email(void){
61 const char *zDest = db_get("email-send-method",0);
62 int nSub, nASub, nPend, nDPend;
63 const char *zDir, *zDb, *zCmd, *zRelay;
 
64 @ <tr><th>Outgoing&nbsp;Email:</th><td>
65 if( fossil_strcmp(zDest,"pipe")==0
66 && (zCmd = db_get("email-send-command",0))!=0
67 ){
68 @ Piped to command "%h(zCmd)"
@@ -110,12 +111,14 @@
110 @ <tr><th><a href="%R/subscribers">Subscribers:</a></th><td>
111 }else{
112 @ <tr><th>Subscribers:</th><td>
113 }
114 nSub = db_int(0, "SELECT count(*) FROM subscriber");
 
115 nASub = db_int(0, "SELECT count(*) FROM subscriber WHERE sverified"
116 " AND NOT sdonotcall AND length(ssub)>1");
 
117 @ %,d(nASub) active, %,d(nSub) total
118 @ </td></tr>
119 }
120
121 /*
122
--- src/stat.c
+++ src/stat.c
@@ -59,10 +59,11 @@
59 */
60 void stats_for_email(void){
61 const char *zDest = db_get("email-send-method",0);
62 int nSub, nASub, nPend, nDPend;
63 const char *zDir, *zDb, *zCmd, *zRelay;
64 int iCutoff;
65 @ <tr><th>Outgoing&nbsp;Email:</th><td>
66 if( fossil_strcmp(zDest,"pipe")==0
67 && (zCmd = db_get("email-send-command",0))!=0
68 ){
69 @ Piped to command "%h(zCmd)"
@@ -110,12 +111,14 @@
111 @ <tr><th><a href="%R/subscribers">Subscribers:</a></th><td>
112 }else{
113 @ <tr><th>Subscribers:</th><td>
114 }
115 nSub = db_int(0, "SELECT count(*) FROM subscriber");
116 iCutoff = db_get_int("email-renew-cutoff",0);
117 nASub = db_int(0, "SELECT count(*) FROM subscriber WHERE sverified"
118 " AND NOT sdonotcall AND length(ssub)>1"
119 " AND lastContact>=%d;", iCutoff);
120 @ %,d(nASub) active, %,d(nSub) total
121 @ </td></tr>
122 }
123
124 /*
125

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button