Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
oetzit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
commul
oetzit
Commits
dd87f262
Commit
dd87f262
authored
2 years ago
by
Paolo Brasolin
Browse files
Options
Downloads
Patches
Plain Diff
feat: clues screen time statistics
parent
abda971e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
backend/public/dashboard.js
+52
-1
52 additions, 1 deletion
backend/public/dashboard.js
backend/src/dashboard.ts
+11
-0
11 additions, 0 deletions
backend/src/dashboard.ts
backend/templates/dashboard.ejs
+5
-0
5 additions, 0 deletions
backend/templates/dashboard.ejs
with
68 additions
and
1 deletion
backend/public/dashboard.js
+
52
−
1
View file @
dd87f262
...
...
@@ -66,6 +66,58 @@ const gamesByDateConfig = {
new
Chart
(
document
.
getElementById
(
"
gamesByDateChart
"
),
gamesByDateConfig
);
//=[ Clues by duration ]========================================================
const
cluesByDurationData
=
JSON
.
parse
(
document
.
getElementById
(
"
cluesByDurationData
"
).
textContent
,
).
filter
((
item
)
=>
item
.
bucket
!=
null
);
const
cluesByDurationConfig
=
{
type
:
"
bar
"
,
data
:
{
datasets
:
[
{
data
:
cluesByDurationData
,
backgroundColor
:
[
...
Array
(
cluesByDurationData
.
length
-
1
).
fill
(
"
blue
"
),
"
red
"
,
],
},
],
},
options
:
{
scales
:
{
x
:
{
type
:
"
linear
"
,
min
:
0
,
max
:
15000
,
},
y
:
{},
},
plugins
:
{
legend
:
{
display
:
false
},
title
:
{
display
:
true
,
text
:
"
Clues screen time [ms] distribution
"
,
},
subtitle
:
{
display
:
true
,
text
:
"
Bins are 150ms wide, labeled by upper bound; clues >15s are lumped in the last bar.
"
,
},
},
parsing
:
{
xAxisKey
:
"
bucket
"
,
yAxisKey
:
"
count
"
,
},
},
};
new
Chart
(
document
.
getElementById
(
"
cluesByDurationChart
"
),
cluesByDurationConfig
,
);
//=[ Shots by duration ]========================================================
const
shotsByDurationData
=
JSON
.
parse
(
...
...
@@ -86,7 +138,6 @@ const shotsByDurationConfig = {
],
},
options
:
{
title
:
"
ASD
"
,
scales
:
{
x
:
{
type
:
"
linear
"
,
...
...
This diff is collapsed.
Click to expand it.
backend/src/dashboard.ts
+
11
−
0
View file @
dd87f262
...
...
@@ -66,6 +66,16 @@ const dashboardPlugin: FastifyPluginCallback = (fastify, options, next) => {
)
.
groupByRaw
(
"
DATE(began_at), ended
"
);
const
cluesByDuration
=
await
connection
.
table
(
"
clues
"
)
.
select
(
connection
.
raw
(
"
width_bucket(ended_at_gmtm - began_at_gmtm, 0, 150*100, 100)*150 as bucket, count(*)
"
,
),
)
.
groupBy
(
"
bucket
"
)
.
orderBy
(
"
bucket
"
);
const
shotsByDuration
=
await
connection
.
table
(
"
shots
"
)
.
select
(
...
...
@@ -121,6 +131,7 @@ const dashboardPlugin: FastifyPluginCallback = (fastify, options, next) => {
shotsCount
,
devicesByDate
,
gamesByDate
,
cluesByDuration
,
shotsByDuration
,
shotsBySimilarity
,
devicesBehaviour
,
...
...
This diff is collapsed.
Click to expand it.
backend/templates/dashboard.ejs
+
5
−
0
View file @
dd87f262
...
...
@@ -86,6 +86,11 @@
<script
id=
"devicesByDateData"
type=
"application/json"
>
<%-
JSON
.
stringify
(
devicesByDate
)
%>
</script>
<canvas
id=
"gamesByDateChart"
></canvas>
<h1>
Clues statistics
</h1>
<script
id=
"cluesByDurationData"
type=
"application/json"
>
<%-
JSON
.
stringify
(
cluesByDuration
)
%>
</script>
<canvas
id=
"cluesByDurationChart"
></canvas>
<h1>
Shots statistics
</h1>
<script
id=
"shotsByDurationData"
type=
"application/json"
>
<%-
JSON
.
stringify
(
shotsByDuration
)
%>
</script>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment