@takagaki/cortex-decisions-viewer 0.12.159 → 0.12.160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.js +8 -2
- package/dist/ranking.js +34 -0
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -2302,9 +2302,12 @@ async function buildSite(opts, views) {
|
|
|
2302
2302
|
const rederived = orderRecordsByLedgers(records, recordsDir, rederive, opts.generatedAt);
|
|
2303
2303
|
// 関係者だけ、関与の多い順(engine の目次と同じ `order`・便 14b)。用語集の並び
|
|
2304
2304
|
// (`orderByActivity`)とは帳簿も式も別で、区画が重ならないので順番に当てても干渉しない
|
|
2305
|
-
const
|
|
2305
|
+
const ledgerOrdered = e.name === "Members"
|
|
2306
2306
|
? (0, engagement_1.orderMembersByEngagement)(rederived, (r) => r.id, engagement, opts.generatedAt)
|
|
2307
2307
|
: rederived;
|
|
2308
|
+
// 一覧は目次と同じ順位のファイル 1 つで並べる(engine #1781・仕様 8-4)。読めた案件では上の帳簿・日付の並びを
|
|
2309
|
+
// 順位で上書きし、順位に無い記録は元の並びのまま末尾。**読めない案件は今までと同じ**
|
|
2310
|
+
const ordered = (0, ranking_1.orderByRanking)(ledgerOrdered, (r) => relOf(recordsDir, r.fileName), (0, ranking_1.rankedPathsOf)(memoryRanking, e.name));
|
|
2308
2311
|
// レコード0件でもタブは出す(空状態から「+AIで登録」できる導線になる)。
|
|
2309
2312
|
// records/ 自体が無いディレクトリ(その区画が未導入の案件)はタブにしない
|
|
2310
2313
|
if (records.length || (await isDirectory(recordsDir))) {
|
|
@@ -2328,6 +2331,9 @@ async function buildSite(opts, views) {
|
|
|
2328
2331
|
return a.date < b.date ? 1 : -1;
|
|
2329
2332
|
return a.id < b.id ? 1 : -1;
|
|
2330
2333
|
});
|
|
2334
|
+
// 決定の一覧も目次と同じ順位で(順位に無い決定は日付の新しい順のまま末尾)。
|
|
2335
|
+
// 🔴 グラフ・月の材料には並べ替える前の `decisions` を渡す(地図の絵が順位で組み変わらない)
|
|
2336
|
+
const rankedDecisions = (0, ranking_1.orderByRanking)(decisions, (d) => recordRelPaths.get(d.id), memoryRanking?.Decisions ?? null);
|
|
2331
2337
|
// 期間フィルタ用の月(YYYY-MM)を日付から導出し、降順(新しい順)にする
|
|
2332
2338
|
const months = uniqueSorted(decisions.map((d) => d.date.slice(0, 7)).filter((m) => /^\d{4}-\d{2}$/.test(m))).reverse();
|
|
2333
2339
|
const graph = buildGraph(decisions, home, graphSections, targetUrls, repo.baseUrl, evidenceBook);
|
|
@@ -2362,7 +2368,7 @@ async function buildSite(opts, views) {
|
|
|
2362
2368
|
viewerVersion: PKG_VERSION,
|
|
2363
2369
|
repoBaseUrl: repo.baseUrl,
|
|
2364
2370
|
branch: repo.branch,
|
|
2365
|
-
decisions,
|
|
2371
|
+
decisions: rankedDecisions,
|
|
2366
2372
|
home,
|
|
2367
2373
|
homeGrounding: homeGrounding,
|
|
2368
2374
|
homeUpdatedAt: homeUpdatedAt,
|
package/dist/ranking.js
CHANGED
|
@@ -7,6 +7,8 @@ exports.MEMORY_RANKING_SECTIONS = exports.MEMORY_RANKING_VERSION = exports.MEMOR
|
|
|
7
7
|
exports.parseMemoryRanking = parseMemoryRanking;
|
|
8
8
|
exports.readMemoryRanking = readMemoryRanking;
|
|
9
9
|
exports.glowByPath = glowByPath;
|
|
10
|
+
exports.orderByRanking = orderByRanking;
|
|
11
|
+
exports.rankedPathsOf = rankedPathsOf;
|
|
10
12
|
/**
|
|
11
13
|
* つながり画面の点の明るさと大きさ(cortex-engine #551・オーナー決定 2026-10-01)。
|
|
12
14
|
*
|
|
@@ -88,3 +90,35 @@ function glowByPath(ranking) {
|
|
|
88
90
|
}
|
|
89
91
|
return out;
|
|
90
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* 一覧を目次と同じ順位で並べ直す(engine #1781・仕様 1-3 / 8-4)。
|
|
95
|
+
*
|
|
96
|
+
* 順位に載っている記録を順位の並びで先に、載っていない記録(順位を書いた夜より後に足された記録など)は
|
|
97
|
+
* **元の並びのまま末尾**に置く(つながり画面の明るさが 0=一番下になるのと同じ向き)。
|
|
98
|
+
* `ranking` が `null`(ファイルが無い・壊れている・版が違う)なら入力をそのまま返す=今までと 1 バイトも同じ。
|
|
99
|
+
*/
|
|
100
|
+
function orderByRanking(items, relPathOf, rankedPaths) {
|
|
101
|
+
if (!rankedPaths)
|
|
102
|
+
return items.slice();
|
|
103
|
+
const rank = new Map();
|
|
104
|
+
rankedPaths.forEach((p, i) => { if (!rank.has(p))
|
|
105
|
+
rank.set(p, i); });
|
|
106
|
+
const ranked = [];
|
|
107
|
+
const rest = [];
|
|
108
|
+
for (const item of items) {
|
|
109
|
+
const p = relPathOf(item);
|
|
110
|
+
const r = p === undefined ? undefined : rank.get(p);
|
|
111
|
+
if (r === undefined)
|
|
112
|
+
rest.push(item);
|
|
113
|
+
else
|
|
114
|
+
ranked.push({ item, r });
|
|
115
|
+
}
|
|
116
|
+
ranked.sort((a, b) => a.r - b.r);
|
|
117
|
+
return [...ranked.map((x) => x.item), ...rest];
|
|
118
|
+
}
|
|
119
|
+
/** 区画名 → 順位の並び。順位が読めない・4 区画の外の区画(Reports 等)は `null`(並べ替えない) */
|
|
120
|
+
function rankedPathsOf(ranking, section) {
|
|
121
|
+
if (!ranking)
|
|
122
|
+
return null;
|
|
123
|
+
return exports.MEMORY_RANKING_SECTIONS.includes(section) ? ranking[section] : null;
|
|
124
|
+
}
|
package/package.json
CHANGED