nerdsinspace / nocom-frontend

The No Comment web application frontend.
GNU Affero General Public License v3.0
8 stars 1 forks source link

more sidebar info #15

Open leijurv opened 4 years ago

leijurv commented 4 years ago

when u click on a cluster it should show more info than just associations

e.g.

number of shulkers, number of chests, most recent online time, first hit timestamp, has legacy, etc

example query that outputs number of shulkers (obv just replace %shulker% with %chest% to get chests):

WITH RECURSIVE
    tmp AS (
        SELECT id, disjoint_rank
        FROM dbscan
        WHERE id = 38916757
    ),
    clusters AS (
        SELECT *
        FROM tmp
        UNION
        SELECT dbscan.id, dbscan.disjoint_rank
        FROM dbscan
                 INNER JOIN clusters ON dbscan.cluster_parent = clusters.id
        WHERE clusters.disjoint_rank > 0
    ),
    shulkers AS MATERIALIZED (
        SELECT block_state
        FROM block_states
        WHERE name LIKE '%shulker%'
    )
SELECT SUM(num_shulkers)
FROM (
         SELECT (
                    SELECT COUNT(*)
                    FROM (
                             SELECT block_state,
                                    ROW_NUMBER() OVER (PARTITION BY x, y, z ORDER BY created_at DESC) AS age
                             FROM blocks
                             WHERE blocks.x >> 4 = dbscan.x
                               AND blocks.z >> 4 = dbscan.z
                         ) tmp
                    WHERE block_state IN (SELECT * FROM shulkers)
                      AND age = 1
                ) AS num_shulkers,
                dbscan.x,
                dbscan.z
         FROM clusters
                  INNER JOIN dbscan ON dbscan.id = clusters.id
     ) tmp;

also do it for signs. in this case, we still want to use the blocks table not signs since signs doesnt keep track of overwrites, so just replace the block scan with sign

fr1kin commented 4 years ago

Sidebar shows if players are online or offline now. If you hover over the indicator it will show the time they joined or the time they were last seen

https://github.com/nerdsinspace/nocom-frontend/commit/538b54797591aeedf1729abf12f8e9edde982a0f