openvibers/openvibe.coupons Commits
Best code: Remind me with the other actions; the expiry as one plain line (#188)
Changes
@@@ -28,7 +28,7 @@ const SITE_SUMMARY = 'Coupon codes for online shops with merchant/domain matchinconst BASIS_LABEL = {evidence: 'as stated on the evidence page',submitter: 'according to the person who submitted it',-- source: 'as stated by the imported source',++ source: 'as the source states',staff: 'set by staff',};const REASON_LABEL = {@@@ -93,7 +93,7 @@ function expiryOf(v) {const day = `${d.getUTCDate()} ${MONTHS[d.getUTCMonth()]} ${d.getUTCFullYear()}`;return {instant,-- short: instant ? `Expires ${day} ${String(d.getUTCHours()).padStart(2, '0')}:${String(d.getUTCMinutes()).padStart(2, '0')} UTC` : `Expires ${day} (end of day, UTC)`,++ short: instant ? `Expires ${day} ${String(d.getUTCHours()).padStart(2, '0')}:${String(d.getUTCMinutes()).padStart(2, '0')} UTC` : `Expires ${day}, end of day UTC`,full: instant ? `${iso.slice(0, 16).replace('T', ' ')} UTC` : `${iso.slice(0, 10)} (end of that day in UTC; the merchant's time zone is not stated)`,basis: e.basis || null,said: BASIS_LABEL[e.basis] || null,@@@ -179,9 +179,9 @@ function bestCard(v, { now, windowDays, csrf, back, shop = '' }) {<div class="cpn-codebox"><code class="cpn-codetext" id="${codeId}">${v.code}</code>${k(copyButton(codeId))}</div><p class="cpn-status-line">${statusText(v)}${lw ? h` · ${lw}` : ''}</p>${lr.ever ? h`<p class="cpn-meta">${lr.iso ? h`<time datetime="${lr.iso}">${lr.text}</time>` : lr.text}</p>` : ''}--<p class="cpn-meta">${ex ? h`${ex.short}${ex.said ? h` (${ex.said})` : ''}` : h`<span class="unknown">Expiry unknown</span>`}${remind ? k(remind) : ''}</p>++<p class="cpn-meta">${ex ? h`${ex.short}${ex.said ? h` · ${ex.said}` : ''}` : h`<span class="unknown">Expiry unknown</span>`}</p>${limits.length ? h`<p class="cpn-meta cpn-limits">${limits.join(' · ')}</p>` : h`<p class="cpn-meta cpn-limits">No restrictions stated. That does not mean there are none.</p>`}--<div class="cpn-votes">${reportForms(v, { csrf, back })}</div>++<div class="cpn-votes">${reportForms(v, { csrf, back })}${remind ? k(remind) : ''}</div></section>`;}@@@ -190,7 +190,7 @@ function codeRow(v, { now, windowDays, csrf, back, shop = '' }) {const lr = lastReport(v, now, windowDays);const ex = expiryOf(v);// No report yet: the status already says so, so it is not said twice.-- const facts = [statusText(v), ...(lr.ever ? [lr.text] : []), ex ? (ex.said ? `${ex.short} (${ex.said})` : ex.short) : 'Expiry unknown'];++ const facts = [statusText(v), ...(lr.ever ? [lr.text] : []), ex ? (ex.said ? `${ex.short} · ${ex.said}` : ex.short) : 'Expiry unknown'];const limits = restrictionText(v.restrictions);const codeId = v.id;// "Remind me" for the moment the code ends (plan L48 R3), with the row's other actions; only when the end is@@@ -166,7 +166,7 @@ function bestCardCode(html) {assert.match(page.text, /id="cpn-sticky"/, 'the slim bar');assert.match(page.text, /hidden/, 'the bar is hidden until the best code leaves the screen');assert.match(page.text, /IntersectionObserver/, 'the few lines that show it');-- assert.match(page.text, /Expires 31 Dec 2026 \(end of day, UTC\)/, 'the expiry with its precision');++ assert.match(page.text, /Expires 31 Dec 2026, end of day UTC/, 'the expiry with its precision');const about = await t.get('/m/' + shop.slug + '?tab=about');assert.strictEqual(about.status, 200);assert.match(about.text, /Quick facts/);
@@ -28,7 +28,7 @@ const SITE_SUMMARY = 'Coupon codes for online shops with merchant/domain matchin
@@ -28,7 +28,7 @@ const SITE_SUMMARY = 'Coupon codes for online shops with merchant/domain matchin
const BASIS_LABEL = {
const BASIS_LABEL = {
evidence: 'as stated on the evidence page',
evidence: 'as stated on the evidence page',
submitter: 'according to the person who submitted it',
submitter: 'according to the person who submitted it',
- source: 'as stated by the imported source',
+ source: 'as the source states',
staff: 'set by staff',
staff: 'set by staff',
};
};
const REASON_LABEL = {
const REASON_LABEL = {
@@ -93,7 +93,7 @@ function expiryOf(v) {
@@ -93,7 +93,7 @@ function expiryOf(v) {
const day = `${d.getUTCDate()} ${MONTHS[d.getUTCMonth()]} ${d.getUTCFullYear()}`;
const day = `${d.getUTCDate()} ${MONTHS[d.getUTCMonth()]} ${d.getUTCFullYear()}`;
return {
return {
instant,
instant,
- short: instant ? `Expires ${day} ${String(d.getUTCHours()).padStart(2, '0')}:${String(d.getUTCMinutes()).padStart(2, '0')} UTC` : `Expires ${day} (end of day, UTC)`,
+ short: instant ? `Expires ${day} ${String(d.getUTCHours()).padStart(2, '0')}:${String(d.getUTCMinutes()).padStart(2, '0')} UTC` : `Expires ${day}, end of day UTC`,
full: instant ? `${iso.slice(0, 16).replace('T', ' ')} UTC` : `${iso.slice(0, 10)} (end of that day in UTC; the merchant's time zone is not stated)`,
full: instant ? `${iso.slice(0, 16).replace('T', ' ')} UTC` : `${iso.slice(0, 10)} (end of that day in UTC; the merchant's time zone is not stated)`,
basis: e.basis || null,
basis: e.basis || null,
said: BASIS_LABEL[e.basis] || null,
said: BASIS_LABEL[e.basis] || null,
@@ -179,9 +179,9 @@ function bestCard(v, { now, windowDays, csrf, back, shop = '' }) {
@@ -179,9 +179,9 @@ function bestCard(v, { now, windowDays, csrf, back, shop = '' }) {
<div class="cpn-codebox"><code class="cpn-codetext" id="${codeId}">${v.code}</code>${k(copyButton(codeId))}</div>
<div class="cpn-codebox"><code class="cpn-codetext" id="${codeId}">${v.code}</code>${k(copyButton(codeId))}</div>
<p class="cpn-status-line">${statusText(v)}${lw ? h` · ${lw}` : ''}</p>
<p class="cpn-status-line">${statusText(v)}${lw ? h` · ${lw}` : ''}</p>
${lr.ever ? h`<p class="cpn-meta">${lr.iso ? h`<time datetime="${lr.iso}">${lr.text}</time>` : lr.text}</p>` : ''}
${lr.ever ? h`<p class="cpn-meta">${lr.iso ? h`<time datetime="${lr.iso}">${lr.text}</time>` : lr.text}</p>` : ''}
-<p class="cpn-meta">${ex ? h`${ex.short}${ex.said ? h` (${ex.said})` : ''}` : h`<span class="unknown">Expiry unknown</span>`}${remind ? k(remind) : ''}</p>
+<p class="cpn-meta">${ex ? h`${ex.short}${ex.said ? h` · ${ex.said}` : ''}` : h`<span class="unknown">Expiry unknown</span>`}</p>
${limits.length ? h`<p class="cpn-meta cpn-limits">${limits.join(' · ')}</p>` : h`<p class="cpn-meta cpn-limits">No restrictions stated. That does not mean there are none.</p>`}
${limits.length ? h`<p class="cpn-meta cpn-limits">${limits.join(' · ')}</p>` : h`<p class="cpn-meta cpn-limits">No restrictions stated. That does not mean there are none.</p>`}
-<div class="cpn-votes">${reportForms(v, { csrf, back })}</div>
+<div class="cpn-votes">${reportForms(v, { csrf, back })}${remind ? k(remind) : ''}</div>
</section>`;
</section>`;
}
}
@@ -190,7 +190,7 @@ function codeRow(v, { now, windowDays, csrf, back, shop = '' }) {
@@ -190,7 +190,7 @@ function codeRow(v, { now, windowDays, csrf, back, shop = '' }) {
const lr = lastReport(v, now, windowDays);
const lr = lastReport(v, now, windowDays);
const ex = expiryOf(v);
const ex = expiryOf(v);
// No report yet: the status already says so, so it is not said twice.
// No report yet: the status already says so, so it is not said twice.
- const facts = [statusText(v), ...(lr.ever ? [lr.text] : []), ex ? (ex.said ? `${ex.short} (${ex.said})` : ex.short) : 'Expiry unknown'];
+ const facts = [statusText(v), ...(lr.ever ? [lr.text] : []), ex ? (ex.said ? `${ex.short} · ${ex.said}` : ex.short) : 'Expiry unknown'];
const limits = restrictionText(v.restrictions);
const limits = restrictionText(v.restrictions);
const codeId = v.id;
const codeId = v.id;
// "Remind me" for the moment the code ends (plan L48 R3), with the row's other actions; only when the end is
// "Remind me" for the moment the code ends (plan L48 R3), with the row's other actions; only when the end is
@@ -166,7 +166,7 @@ function bestCardCode(html) {
@@ -166,7 +166,7 @@ function bestCardCode(html) {
assert.match(page.text, /id="cpn-sticky"/, 'the slim bar');
assert.match(page.text, /id="cpn-sticky"/, 'the slim bar');
assert.match(page.text, /hidden/, 'the bar is hidden until the best code leaves the screen');
assert.match(page.text, /hidden/, 'the bar is hidden until the best code leaves the screen');
assert.match(page.text, /IntersectionObserver/, 'the few lines that show it');
assert.match(page.text, /IntersectionObserver/, 'the few lines that show it');
- assert.match(page.text, /Expires 31 Dec 2026 \(end of day, UTC\)/, 'the expiry with its precision');
+ assert.match(page.text, /Expires 31 Dec 2026, end of day UTC/, 'the expiry with its precision');
const about = await t.get('/m/' + shop.slug + '?tab=about');
const about = await t.get('/m/' + shop.slug + '?tab=about');
assert.strictEqual(about.status, 200);
assert.strictEqual(about.status, 200);
assert.match(about.text, /Quick facts/);
assert.match(about.text, /Quick facts/);