Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ehasa-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WIMMA Lab 2019
Overflow
ehasa-backend
Commits
1ea88b9f
Commit
1ea88b9f
authored
5 years ago
by
L4168
Browse files
Options
Downloads
Patches
Plain Diff
format data for group cluster
parent
43ab21fa
No related branches found
No related tags found
3 merge requests
!59
Development to master
,
!58
Development to testing
,
!56
Cluster update to Development
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tracking/tracking.service.ts
+31
-13
31 additions, 13 deletions
src/tracking/tracking.service.ts
with
31 additions
and
13 deletions
src/tracking/tracking.service.ts
+
31
−
13
View file @
1ea88b9f
...
...
@@ -77,28 +77,46 @@ export class TrackingService {
let
factions
=
await
this
.
factionRepository
.
find
({
game
:
gameId
});
playerdata
=
await
Promise
.
all
(
factions
.
map
(
async
faction
=>
{
r
et
urn
await
this
.
trackingrepository
.
find
({
l
et
rawdata
=
await
this
.
trackingrepository
.
find
({
where
:
{
faction
:
faction
.
factionId
},
relations
:
[
'
faction
'
,
'
gamepersonId
'
],
});
let
groups
=
{
'
infantry.svg
'
:
[],
'
recon.svg
'
:
[],
'
mechanized.svg
'
:
[],
};
rawdata
.
forEach
(
async
player
=>
{
groups
[
player
.
icon
].
push
(
player
);
});
return
groups
;
}),
);
}
// parse data
// create an array for each faction
// inside faction create an array for each icon type
// insisde icon arrays include all players with same icon
const
currentdata
=
await
Promise
.
all
(
await
playerdata
.
map
(
async
faction
=>
{
return
await
Promise
.
all
(
faction
.
map
(
async
player
=>
{
return
await
{
gamepersonId
:
player
[
'
gamepersonId
'
][
'
gamepersonId
'
],
gamepersonRole
:
player
[
'
gamepersonId
'
][
'
role
'
],
factionId
:
player
[
'
faction
'
][
'
factionId
'
],
factionColour
:
player
[
'
faction
'
][
'
colour
'
],
icon
:
player
[
'
icon
'
],
coordinates
:
player
[
'
data
'
].
pop
(),
};
}),
);
let
data
=
[];
for
(
let
group
in
faction
)
{
data
.
push
(
await
Promise
.
all
(
faction
[
group
].
map
(
async
player
=>
{
return
await
{
gamepersonId
:
player
[
'
gamepersonId
'
][
'
gamepersonId
'
],
gamepersonRole
:
player
[
'
gamepersonId
'
][
'
role
'
],
factionId
:
player
[
'
faction
'
][
'
factionId
'
],
factionColour
:
player
[
'
faction
'
][
'
colour
'
],
icon
:
player
[
'
icon
'
],
coordinates
:
player
[
'
data
'
].
pop
(),
};
}),
),
);
}
return
data
;
}),
);
return
currentdata
;
...
...
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