chore(demo): move to right directory

This commit is contained in:
Elian Doran
2025-05-27 18:34:04 +03:00
parent 7cb4cc8469
commit 099e73b114
173 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<div style="padding: 20px">
<p>This table shows notes which are linked by other notes through relations</p>
<table class="table stats-table" style="font-size: 90%;">
<tr>
<th>Note</th>
<th nowrap>Relation count</th>
</tr>
</table>
</div>

View File

@@ -0,0 +1,26 @@
const notes = await api.runOnBackend(() => {
return api.sql.getRows(`
SELECT
notes.noteId,
COUNT(attributes.attributeId) AS count
FROM notes
JOIN attributes ON attributes.value = notes.noteId
WHERE notes.isDeleted = 0
AND attributes.isDeleted = 0
AND attributes.type = 'relation'
GROUP BY notes.noteId
ORDER BY count DESC
LIMIT 100`);
});
const $statsTable = api.$container.find('.stats-table');
for (const note of notes) {
$statsTable.append(
$("<tr>")
.append(
$("<td>").append(await api.createLink(note.noteId, {showNotePath: true}))
)
.append($("<td nowrap>").text(note.count))
);
}