Move fraction mapping to war entity; map new fraction names in admin panel

pull/60/head
HardiReady 2019-10-01 11:55:25 +02:00
parent 8b20eab3b5
commit b54f02cda4
9 changed files with 16 additions and 18 deletions

View File

@ -5,8 +5,6 @@ Campaign entity
## Properties
+ _id:`5abd55ea9e30a76bfef747d6` (string, required) - unique id 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
+ updatedAt: `"2017-05-17T19:44:28.751Z` (string, required) - version date
+ __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
+ date: `2018-02-24T20:01:25.825Z` (string, required) - war start 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
+ ptOpfor: 12 (number, required) - final points fraction Opfor
+ playersBlufor: 36 (number, required) - player count of fraction Blufor

View File

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

View File

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

View File

@ -44,7 +44,6 @@ decorationRouter.route('/')
if (req.query.q) {
filter.name = {$regex: req.query.q, $options: 'i'};
}
console.log(filter)
DecorationModel.find(filter, {}, {
sort: {
fraction: 'asc',

View File

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

View File

@ -23,7 +23,7 @@
[(ngModel)]="appUserSquadId">
<option [value]="null">{{'user.submit.field.squad.not.assigned' | translate}}</option>
<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>
</select>
<show-error displayName="{{'user.submit.field.squad' | translate}}" controlPath="squad"></show-error>

View File

@ -6,8 +6,8 @@
<a>{{appUser.username}}</a>
</span>
<br>
<small *ngIf="appUser.squad && appUser.squad.fraction == 'OPFOR'">{{fraction.OPFOR}} - {{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 == 'OPFOR'">{{fraction.SWORD}} - {{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>
</div>

View File

@ -13,5 +13,5 @@ export enum Fraction {
COLOR_OPFOR_DARK = '#890F0F',
COLOR_OPFOR_LIGHT = '#fb5555',
COLOR_OPFOR_GREY = '#955c5f',
COLOR_NEUTRAL = '#666666',
COLOR_NEUTRAL = '#222222',
}