Scope disconnect matching to Feature column; gate 19/9 on PTW70 product.

PTW_* keywords match only in the Feature cell. Modules 19 and 9 match only when Product contains PTW70 (e.g. 1 PTW70) and Feature is exactly 19 or 9. Rebuild distributables.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Michael-A-SloanandCursor committed 2026-05-05 15:22:52 -04:00
1 parent d3d45d90c3
commit 4ef1f6849c
8 files changed
+41 -23

No files matched your search

+3 -1
View File
@@ -13,6 +13,8 @@ Standalone desktop app that monitors your PTW sessions page and automatically di
## Target keywords (disconnect when present)
Matching uses the **Feature** column only (not the whole row). Product text such as `1 PTW70` is not searched for keywords.
- PTW_DATAEXCHANGE
- PTW_ARC_FLASH
- PTW_DEVEVAL
@@ -23,7 +25,7 @@ Standalone desktop app that monitors your PTW sessions page and automatically di
- PTW_IEC_FAULT
- PTW_IEC61363
**Modules 19 and 9:** Disconnect only when the **Product** or **Feature** column equals exactly `19` or `9` (whole cell, not a substring search on the row — searching the full row for `9` or `19` matches dates and other numbers and disconnects everyone).
**Modules 19 and 9:** Disconnect when **Product** contains `PTW70` (e.g. `1 PTW70`) and **Feature** equals exactly `19` or `9`.
## Requirements
+15 -8
View File
@@ -7,8 +7,8 @@
'PTW_DAPPER', 'PTW_COOREVAL', 'PTW_CAPTOR', 'PTW_IEC_FAULT', 'PTW_IEC61363'
];
/** Matched only against Product / Feature cells (exact text), never whole-row substring — bare "9"/"19" match almost every row. */
const TARGET_PRODUCT_FEATURE_IDS = ['19', '9'];
/** Exact match on Feature cell only; Product must look like PTW70 (e.g. "1 PTW70") so "9"/"19" do not fire on other lines. */
const TARGET_FEATURE_IDS = ['19', '9'];
window.__ptw_logQueue = window.__ptw_logQueue || [];
window.__ptw_running = window.__ptw_running !== false;
@@ -26,10 +26,17 @@
return { product: product, feature: feature };
}
function matchesProductFeatureId(product, feature) {
return TARGET_PRODUCT_FEATURE_IDS.some(function (id) {
return product === id || feature === id;
});
function isPtw70Product(product) {
return product.indexOf('PTW70') !== -1;
}
function matchesKeywordInFeature(feature) {
return TARGET_KEYWORDS.some(function (k) { return feature.indexOf(k) !== -1; });
}
function matchesFeatureId(product, feature) {
if (!isPtw70Product(product)) return false;
return TARGET_FEATURE_IDS.some(function (id) { return feature === id; });
}
function scanAndDisconnect() {
@@ -38,8 +45,8 @@
rows.forEach(function (row) {
const rowText = row.innerText;
var pf = productFeatureCells(row);
const keywordMatch = TARGET_KEYWORDS.some(function (k) { return rowText.indexOf(k) !== -1; });
const idMatch = matchesProductFeatureId(pf.product, pf.feature);
const keywordMatch = matchesKeywordInFeature(pf.feature);
const idMatch = matchesFeatureId(pf.product, pf.feature);
if (keywordMatch || idMatch) {
const disconnectLink = row.querySelector('a.sbutton');
if (disconnectLink && disconnectLink.textContent.indexOf('Disconnect') !== -1) {