Get the graph rendering as expected
This commit is contained in:
parent
3796687a72
commit
5e9b91b199
5 changed files with 98 additions and 24 deletions
|
|
@ -52,13 +52,17 @@ export class MemoryDatabase {
|
|||
if (!subtable) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const size = Number.parseInt(subtable.slice(1));
|
||||
const rows = [];
|
||||
|
||||
for (let i = 1; i <= size; i++) {
|
||||
const count = getNormalDistributionHeight(i, size / 2, size);
|
||||
console.table({ count, i });
|
||||
const temp = new Array(count).fill(null).map(() => generateRow(i));
|
||||
const temp = new Array(count)
|
||||
.fill(null)
|
||||
.map(() => generateRow(
|
||||
game.user.id == user ? i : Math.ceil(Math.random() * size),
|
||||
));
|
||||
rows.push(...temp);
|
||||
};
|
||||
|
||||
|
|
|
|||
19
module/utils/sorters/smallToLarge.mjs
Normal file
19
module/utils/sorters/smallToLarge.mjs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
*
|
||||
* @param {string | number} a
|
||||
* @param {string | number} b
|
||||
*/
|
||||
export function smallToLarge(a, b) {
|
||||
const aInt = Number.parseInt(a);
|
||||
const bInt = Number.parseInt(b);
|
||||
|
||||
const aIsInvalid = Number.isNaN(aInt);
|
||||
const bIsInvalid = Number.isNaN(bInt);
|
||||
if (aIsInvalid && bIsInvalid) {
|
||||
return a > b;
|
||||
} else if (aIsInvalid || bIsInvalid) {
|
||||
return aIsInvalid ? -1 : 1;
|
||||
};
|
||||
|
||||
return Math.sign(aInt - bInt);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue