Compare commits

...

3 Commits

7 changed files with 49 additions and 22 deletions

View File

@ -24,6 +24,9 @@ const vehicleRegex = /(vehicle:\s(.*?)\))/;
const categoryRegex = /(category:\s(.*?)\))/;
const parseWarLog = (lineArray, war) => {
let flagBlufor = true;
let flagOpfor = true;
const NAME_TOO_LONG_ERROR = 'Error: ENAMETOOLONG: name too long, open \'';
const stats = {
@ -164,11 +167,21 @@ const parseWarLog = (lineArray, war) => {
/**
* FLAG
*/
stats.clean.push(line);
const playerName = line.substring(line.lastIndexOf('rt von ') + 7).slice(0, -1);
const flagFraction = line.includes('NATO Flagge') ? 'BLUFOR' : 'OPFOR';
const capture = !!line.includes('Flagge erobert');
if ((flagFraction === 'BLUFOR' && ((capture && flagBlufor) || (!capture && !flagBlufor))) ||
(flagFraction === 'OPFOR' && ((capture && flagOpfor) || (!capture && !flagOpfor)))) {
stats.clean.push(line);
const playerName = line.substring(line.lastIndexOf('rt von ') + 7).slice(0, -1);
if (flagFraction === 'BLUFOR') {
flagBlufor = !capture;
} else if (flagFraction === 'OPFOR') {
flagOpfor = !capture;
}
stats.flag.push({
war: war._id,
time: getFullTimeDate(war.date, line.split(WHITESPACE)[5]),
@ -176,6 +189,7 @@ const parseWarLog = (lineArray, war) => {
flagFraction: flagFraction,
capture: capture,
});
}
} else if (line.includes('(Punkte)')) {
/**
* POINTS

View File

@ -98,7 +98,7 @@
<li *ngIf="!loginService.isLoggedIn()" routerLinkActive="active">
<a routerLink='{{config.loginPath}}' class="link">{{'navigation.top.login' | translate}}</a>
</li>
<li class="dropdown">
<li class="dropdown" *ngIf="FEATURE_LOCALIZATION_ENABLED">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false" style="padding: 12px 12px 10px 12px;">
<mat-icon svgIcon="{{(language === 'de') ? 'flag-de' : 'flag-gb'}}"></mat-icon>

View File

@ -6,7 +6,7 @@ import {AwardingService} from './services/army-management/awarding.service';
import {RouteConfig} from './app.config';
import {DOCUMENT} from '@angular/common';
import {DomSanitizer} from '@angular/platform-browser';
import {MatIconRegistry, MatSelectChange} from '@angular/material';
import {MatIconRegistry} from '@angular/material';
import {SpinnerService} from './services/user-interface/spinner/spinner.service';
import {TranslateService} from '@ngx-translate/core';
import {SettingsService} from './services/settings.service';
@ -20,6 +20,8 @@ declare function require(url: string);
})
export class AppComponent implements OnInit {
readonly FEATURE_LOCALIZATION_ENABLED = false;
config = RouteConfig;
loading = false;

View File

@ -33,7 +33,7 @@ export class CampaignService {
submitCampaign(campaign: Campaign) {
let requestUrl: string;
let requestMethod: RequestMethod
let requestMethod: RequestMethod;
let accessType;
if (campaign._id) {

View File

@ -12,7 +12,7 @@
{{'stats.campaign.title.all.time.overview' | translate}}
</div>
<div class="campaign-entry"
*ngFor="let campaign of campaigns"
*ngFor="let campaign of campaigns$ | async"
[ngClass]="{active : campaign._id === selectedCampaignId}"
(click)="select(campaign)">
{{campaign.title}}

View File

@ -1,15 +1,25 @@
import {Component, ElementRef, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild} from '@angular/core';
import {
Component,
ElementRef,
EventEmitter,
Input,
OnInit,
Output,
ViewChild
} from '@angular/core';
import {Campaign} from '../../../models/model-interfaces';
import {LoginService} from '../../../services/app-user-service/login-service';
import {Observable} from 'rxjs';
import {CampaignService} from '../../../services/logs/campaign.service';
@Component({
selector: 'campaign-navigation',
templateUrl: './campaign-navigation.component.html',
styleUrls: ['./campaign-navigation.component.css']
})
export class CampaignNavigationComponent implements OnChanges {
export class CampaignNavigationComponent implements OnInit {
@Input() campaigns: Campaign[];
campaigns$: Observable<Campaign[]>;
@Input() selectedCampaignId;
@ -27,13 +37,15 @@ export class CampaignNavigationComponent implements OnChanges {
repeater;
constructor(public loginService: LoginService) {
constructor(public loginService: LoginService,
private campaignService: CampaignService) {
this.campaigns$ = campaignService.campaigns$;
}
ngOnChanges(changes: SimpleChanges) {
if (!changes.selectedCampaignId) {
this.isRightScrollVisible = this.campaigns.length > 4;
}
ngOnInit() {
this.campaigns$.subscribe(campaigns => {
this.isRightScrollVisible = campaigns.length > 4;
});
}
select(campaign) {

View File

@ -1,5 +1,4 @@
<campaign-navigation
[campaigns]="campaigns"
[selectedCampaignId]="selectedCampaign._id"
(campaignSelect)="switchCampaign($event)"
(campaignEdit)="editCampaign($event)"