Compare commits

..

5 Commits

13 changed files with 35 additions and 28 deletions

View File

@ -5,8 +5,6 @@ Campaign entity
## Properties ## Properties
+ _id:`5abd55ea9e30a76bfef747d6` (string, required) - unique id of the campaign + _id:`5abd55ea9e30a76bfef747d6` (string, required) - unique id of the campaign
+ title: `Ein Kessel Buntes` (string, required) - display title of the campaign + title: `Ein Kessel Buntes` (string, required) - display title of the campaign
+ fractionMappingBlufor: `BLUFOR` (enum[string], required) - mapping for Blufor fraction across the campaign
+ fractionMappingOpfor: `OPFOR` (enum[string], required) - mapping for Opfor fraction across the campaign
+ timestamp: `2017-05-17T19:44:28.751Z` (string, required) - creation date + timestamp: `2017-05-17T19:44:28.751Z` (string, required) - creation date
+ updatedAt: `"2017-05-17T19:44:28.751Z` (string, required) - version date + updatedAt: `"2017-05-17T19:44:28.751Z` (string, required) - version date
+ __v: 0 (number, required) - version number + __v: 0 (number, required) - version number

View File

@ -6,6 +6,8 @@ A war as used in statistics
+ title: `Battle No.1` (string, required) - the display neme of the war + title: `Battle No.1` (string, required) - the display neme of the war
+ date: `2018-02-24T20:01:25.825Z` (string, required) - war start timestamp + date: `2018-02-24T20:01:25.825Z` (string, required) - war start timestamp
+ endDate: `2018-02-24T22:31:26.855Z` (string, required) - war end timestamp + endDate: `2018-02-24T22:31:26.855Z` (string, required) - war end timestamp
+ fractionMappingBlufor: `BLUFOR` (enum[string], required) - display name mapping for Blufor fraction
+ fractionMappingOpfor: `OPFOR` (enum[string], required) - display name mapping for Opfor fraction
+ ptBlufor: 11 (number, required) - final points fraction Blufor + ptBlufor: 11 (number, required) - final points fraction Blufor
+ ptOpfor: 12 (number, required) - final points fraction Opfor + ptOpfor: 12 (number, required) - final points fraction Opfor
+ playersBlufor: 36 (number, required) - player count of fraction Blufor + playersBlufor: 36 (number, required) - player count of fraction Blufor

View File

@ -8,16 +8,6 @@ const CampaignSchema = new Schema({
type: String, type: String,
required: true, required: true,
}, },
fractionMappingBlufor: {
type: String,
enum: ['BLUFOR', 'OPFOR', 'ARF', 'SWORD'],
default: 'BLUFOR',
},
fractionMappingOpfor: {
type: String,
enum: ['BLUFOR', 'OPFOR', 'ARF', 'SWORD'],
default: 'OPFOR',
},
}, { }, {
collection: 'campaign', collection: 'campaign',
timestamps: {createdAt: 'timestamp'}, timestamps: {createdAt: 'timestamp'},

View File

@ -14,6 +14,16 @@ const WarSchema = new Schema({
endDate: { endDate: {
type: Date, type: Date,
}, },
fractionMappingBlufor: {
type: String,
enum: ['BLUFOR', 'OPFOR', 'ARF', 'SWORD'],
default: 'BLUFOR',
},
fractionMappingOpfor: {
type: String,
enum: ['BLUFOR', 'OPFOR', 'ARF', 'SWORD'],
default: 'OPFOR',
},
ptBlufor: { ptBlufor: {
type: Number, type: Number,
get: (v) => Math.round(v), get: (v) => Math.round(v),

View File

@ -37,7 +37,11 @@ decorationRouter.route('/')
.get((req, res, next) => { .get((req, res, next) => {
const filter = {}; const filter = {};
if (req.query.fractFilter) { if (req.query.fractFilter) {
filter.fraction = req.query.fractFilter.toUpperCase(); filter.fraction = {
'$in': req.query.fractFilter
.toUpperCase()
.split(','),
};
} }
if (req.query.q) { if (req.query.q) {
filter.name = {$regex: req.query.q, $options: 'i'}; filter.name = {$regex: req.query.q, $options: 'i'};

View File

@ -168,7 +168,6 @@ users.route('/:id')
res.locals.items = item; res.locals.items = item;
} else { } else {
err.status = codes.wrongrequest; err.status = codes.wrongrequest;
console.log(err);
err.message += ' in fields: ' + Object.getOwnPropertyNames(err.errors); err.message += ' in fields: ' + Object.getOwnPropertyNames(err.errors);
} }

View File

@ -19,8 +19,7 @@ const {exec} = require('child_process');
// cluster mode // cluster mode
const cluster = require('cluster'); const cluster = require('cluster');
const envWorkerNum = process.env.NODE_WORKER_COUNT; const envWorkerNum = process.env.NODE_WORKER_COUNT;
const cpuCount = require('os').cpus().length; const numWorkers = (envWorkerNum) ? envWorkerNum : 2;
const numWorkers = (envWorkerNum) ? envWorkerNum : cpuCount;
// own modules // own modules
const config = require('./config/config'); const config = require('./config/config');

View File

@ -72,7 +72,7 @@ const parseWarLog = (lineArray, war) => {
'Qilin (Unbewaffnet)', 'Qilin (Bewaffnet)', 'Ifrit', 'Qilin (Unbewaffnet)', 'Qilin (Bewaffnet)', 'Ifrit',
'Tempest-Transporter', 'Tempest-Transporter (abgedeckt)', 'Tempest Sanitätsfahrzeug', 'Tempest-Transporter', 'Tempest-Transporter (abgedeckt)', 'Tempest Sanitätsfahrzeug',
'Remote Designator [CSAT]', 'UBF Saif', 'Remote Designator [CSAT]', 'UBF Saif',
'Quad Bike', 'HuntIR', 'Quad Bike', 'HuntIR', 'Offroad',
]; ];
const addPlayerIfNotExists = (inputPlayer, steamUUID) => { const addPlayerIfNotExists = (inputPlayer, steamUUID) => {

View File

@ -23,7 +23,7 @@
[(ngModel)]="appUserSquadId"> [(ngModel)]="appUserSquadId">
<option [value]="null">{{'user.submit.field.squad.not.assigned' | translate}}</option> <option [value]="null">{{'user.submit.field.squad.not.assigned' | translate}}</option>
<option *ngFor="let squad of squads" [ngValue]="squad._id"> <option *ngFor="let squad of squads" [ngValue]="squad._id">
{{squad.fraction == 'BLUFOR'? fraction.BLUFOR : fraction.OPFOR}}: {{squad.name}} {{squad.fraction == 'BLUFOR'? fraction.ARF : fraction.SWORD}}: {{squad.name}}
</option> </option>
</select> </select>
<show-error displayName="{{'user.submit.field.squad' | translate}}" controlPath="squad"></show-error> <show-error displayName="{{'user.submit.field.squad' | translate}}" controlPath="squad"></show-error>

View File

@ -6,8 +6,8 @@
<a>{{appUser.username}}</a> <a>{{appUser.username}}</a>
</span> </span>
<br> <br>
<small *ngIf="appUser.squad && appUser.squad.fraction == 'OPFOR'">{{fraction.OPFOR}} - {{appUser.squad.name}}</small> <small *ngIf="appUser.squad && appUser.squad.fraction == 'OPFOR'">{{fraction.SWORD}} - {{appUser.squad.name}}</small>
<small *ngIf="appUser.squad && appUser.squad.fraction == 'BLUFOR'">{{fraction.BLUFOR}} - {{appUser.squad.name}}</small> <small *ngIf="appUser.squad && appUser.squad.fraction == 'BLUFOR'">{{fraction.ARF}} - {{appUser.squad.name}}</small>
<small *ngIf="!appUser.squad">{{'users.list.item.label.no.squad' | translate}}</small> <small *ngIf="!appUser.squad">{{'users.list.item.label.no.squad' | translate}}</small>
</div> </div>

View File

@ -35,12 +35,10 @@
</div> </div>
<div class="div-table-row" [style.display]="decoPreviewDisplay" style="margin-top: 5px; margin-bottom:10px"> <div class="div-table-row" [style.display]="decoPreviewDisplay" style="margin-top: 5px; margin-bottom:10px">
<div class="col-sm-1 decoration-preview"> <div class="decoration-preview">
<img class="center-block" #decoPreview> <img class="center-block" #decoPreview>
</div> </div>
<div class="col-sm-2" <div style="border-radius: 0px 15px 15px 0px; font-style: oblique; padding: 0 10px" #decoDescription>
style="border-radius: 0px 15px 15px 0px; font-style: oblique" #decoDescription>
&nbsp;
</div> </div>
</div> </div>

View File

@ -7,6 +7,7 @@ import {DecorationService} from '../../services/army-management/decoration.servi
import {UserService} from '../../services/army-management/user.service'; import {UserService} from '../../services/army-management/user.service';
import {LoginService} from '../../services/app-user-service/login-service'; import {LoginService} from '../../services/app-user-service/login-service';
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service'; import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
import {Fraction} from '../../utils/fraction.enum';
@Component({ @Component({
@ -47,7 +48,13 @@ export class RequestAwardComponent implements OnInit {
this.userService.findUsers({squadId: currentUser.squad._id}).subscribe(users => { this.userService.findUsers({squadId: currentUser.squad._id}).subscribe(users => {
this.users = users; this.users = users;
}); });
this.decorationService.findDecorations('', currentUser.squad.fraction).subscribe(decorations => {
const selectableFractions = [
(currentUser.squad.fraction === Fraction.BLUFOR) ? Fraction.ARF : Fraction.SWORD,
currentUser.squad.fraction
];
this.decorationService.findDecorations('', selectableFractions).subscribe(decorations => {
this.decorations = decorations; this.decorations = decorations;
}); });
} }

View File

@ -1,8 +1,8 @@
export enum Fraction { export enum Fraction {
ARF = 'ARF', ARF = 'ARF',
COLOR_ARF = '#668866', COLOR_ARF = '#336699',
SWORD = 'SWORD', SWORD = 'SWORD',
COLOR_SWORD = '#9499a1', COLOR_SWORD = '#8b8b8b',
BLUFOR = 'NATO', BLUFOR = 'NATO',
OPFOR = 'CSAT', OPFOR = 'CSAT',
COLOR_BLUFOR = '#3c5fa1', COLOR_BLUFOR = '#3c5fa1',
@ -13,5 +13,5 @@ export enum Fraction {
COLOR_OPFOR_DARK = '#890F0F', COLOR_OPFOR_DARK = '#890F0F',
COLOR_OPFOR_LIGHT = '#fb5555', COLOR_OPFOR_LIGHT = '#fb5555',
COLOR_OPFOR_GREY = '#955c5f', COLOR_OPFOR_GREY = '#955c5f',
COLOR_NEUTRAL = '#666666', COLOR_NEUTRAL = '#222222',
} }