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:
1 parent
d3d45d90c3
commit
4ef1f6849c
8 files changed
+41
-23
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user