remove unused code

This commit is contained in:
Przemysław Stawujak 2019-01-03 17:32:06 +01:00
parent 537f08e99c
commit 761596db7d
10 changed files with 38 additions and 461 deletions

View File

@ -82,7 +82,6 @@ export class CompetitionCreateComponent extends AppComponentBase implements OnIn
}
public saveCompetition(): void {
console.log('Save competition');
if ((this.createCompetition.maxClass < this.createCompetition.minClass)
|| (!this.createCompetition.startDate)

View File

@ -54,7 +54,6 @@ export class CompetitionDetailComponent extends AppComponentBase implements OnIn
this.routeSubscription = this.route.params
.subscribe(params => {
this.competitionId = +params['id'];
console.log('competitionId: ' + this.competitionId);
this.getCompetition();
})
@ -71,13 +70,10 @@ export class CompetitionDetailComponent extends AppComponentBase implements OnIn
this.competition = data[0];
this.competition.questions.forEach((x) => this.shuffleOptions(x.questionOptions));
this.pager.count = this.competition.questions.length;
console.log(this.competition);
this.canSolveCompetition = data[1];
console.log(this.canSolveCompetition);
this.ranking = data[2];
console.log(this.ranking);
});
}
@ -97,7 +93,6 @@ export class CompetitionDetailComponent extends AppComponentBase implements OnIn
}
public solveCompetition(): void {
console.log('Solve Competition');
this.mode = 'quiz';
}
@ -108,7 +103,6 @@ export class CompetitionDetailComponent extends AppComponentBase implements OnIn
public onSelect(question: QuestionDto, option: QuestionOptionDto) {
question.questionOptions.forEach((x) => { if (x.id !== option.id) x.selected = false; });
console.log(question);
}
public goTo(index: number) {
@ -131,7 +125,6 @@ export class CompetitionDetailComponent extends AppComponentBase implements OnIn
) points += 1;
});
console.log('Points: ' + points);
let rankingPosition = new CreateRankingPositionDto();
rankingPosition.competitionId = this.competitionId;

View File

@ -67,12 +67,10 @@ export class CompetitionsListComponent extends AppComponentBase implements OnIni
return competitionListStream
})).subscribe((result: List<CompetitionDto>) => {
this.competitionsList = result;
console.log(this.competitionsList);
});
}
public goToDetail(competition: CompetitionDto): void {
console.log(this.router.url);
const route: string = this.router.url + `/competitions/${competition.id}`;
//const route: string = `app/competitions/${competition.id}`;
this.router.navigate([route]);

View File

@ -0,0 +1,3 @@
h2 {
color: #771111;
}

View File

@ -1,310 +1,7 @@
<div [@routerTransition]>
<div [@routerTransition] id="home-area">
<div class="block-header">
<h2>MOJE KONKURSY</h2>
</div>
<!-- Widgets -->
<div class="row clearfix">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="info-box bg-pink hover-expand-effect">
<div class="icon">
<i class="material-icons">playlist_add_check</i>
</div>
<div class="content">
<div class="text">NEW TASKS</div>
<div class="number count-to" data-from="0" data-to="125" data-speed="1000" data-fresh-interval="20"></div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="info-box bg-cyan hover-expand-effect">
<div class="icon">
<i class="material-icons">help</i>
</div>
<div class="content">
<div class="text">NEW TICKETS</div>
<div class="number count-to" data-from="0" data-to="257" data-speed="1000" data-fresh-interval="20"></div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="info-box bg-light-green hover-expand-effect">
<div class="icon">
<i class="material-icons">forum</i>
</div>
<div class="content">
<div class="text">NEW COMMENTS</div>
<div class="number count-to" data-from="0" data-to="243" data-speed="1000" data-fresh-interval="20"></div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="info-box bg-orange hover-expand-effect">
<div class="icon">
<i class="material-icons">person_add</i>
</div>
<div class="content">
<div class="text">NEW VISITORS</div>
<div class="number count-to" data-from="0" data-to="1225" data-speed="1000" data-fresh-interval="20"></div>
</div>
</div>
</div>
</div>
<!-- #END# Widgets -->
<!-- CPU Usage -->
<div class="row clearfix">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="card">
<div class="header">
<div class="row clearfix">
<div class="col-xs-12 col-sm-6">
<h2>CPU USAGE (%)</h2>
</div>
<div class="col-xs-12 col-sm-6 align-right">
<div class="switch panel-switch-btn">
<span class="m-r-10 font-12">REAL TIME</span>
<label>OFF<input type="checkbox" id="realtime" checked><span class="lever switch-col-cyan"></span>ON</label>
</div>
</div>
</div>
<ul class="header-dropdown m-r--5">
<li class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<i class="material-icons">more_vert</i>
</a>
<ul class="dropdown-menu pull-right">
<li><a href="javascript:void(0);">Action</a></li>
<li><a href="javascript:void(0);">Another action</a></li>
<li><a href="javascript:void(0);">Something else here</a></li>
</ul>
</li>
</ul>
</div>
<div class="body">
<div id="real_time_chart" class="dashboard-flot-chart"></div>
</div>
</div>
</div>
</div>
<!-- #END# CPU Usage -->
<div class="row clearfix">
<!-- Visitors -->
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card">
<div class="body bg-pink">
<div class="sparkline" data-type="line" data-spot-Radius="4" data-highlight-Spot-Color="rgb(233, 30, 99)" data-highlight-Line-Color="#fff"
data-min-Spot-Color="rgb(255,255,255)" data-max-Spot-Color="rgb(255,255,255)" data-spot-Color="rgb(255,255,255)"
data-offset="90" data-width="100%" data-height="92px" data-line-Width="2" data-line-Color="rgba(255,255,255,0.7)"
data-fill-Color="rgba(0, 188, 212, 0)">
12,10,9,6,5,6,10,5,7,5,12,13,7,12,11
</div>
<ul class="dashboard-stat-list">
<li>
TODAY
<span class="pull-right"><b>1 200</b> <small>USERS</small></span>
</li>
<li>
YESTERDAY
<span class="pull-right"><b>3 872</b> <small>USERS</small></span>
</li>
<li>
LAST WEEK
<span class="pull-right"><b>26 582</b> <small>USERS</small></span>
</li>
</ul>
</div>
</div>
</div>
<!-- #END# Visitors -->
<!-- Latest Social Trends -->
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card">
<div class="body bg-cyan">
<div class="m-b--35 font-bold">LATEST SOCIAL TRENDS</div>
<ul class="dashboard-stat-list">
<li>
#socialtrends
<span class="pull-right">
<i class="material-icons">trending_up</i>
</span>
</li>
<li>
#materialdesign
<span class="pull-right">
<i class="material-icons">trending_up</i>
</span>
</li>
<li>#adminbsb</li>
<li>#freeadmintemplate</li>
<li>#bootstraptemplate</li>
<li>
#freehtmltemplate
<span class="pull-right">
<i class="material-icons">trending_up</i>
</span>
</li>
</ul>
</div>
</div>
</div>
<!-- #END# Latest Social Trends -->
<!-- Answered Tickets -->
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card">
<div class="body bg-teal">
<div class="font-bold m-b--35">ANSWERED TICKETS</div>
<ul class="dashboard-stat-list">
<li>
TODAY
<span class="pull-right"><b>12</b> <small>TICKETS</small></span>
</li>
<li>
YESTERDAY
<span class="pull-right"><b>15</b> <small>TICKETS</small></span>
</li>
<li>
LAST WEEK
<span class="pull-right"><b>90</b> <small>TICKETS</small></span>
</li>
<li>
LAST MONTH
<span class="pull-right"><b>342</b> <small>TICKETS</small></span>
</li>
<li>
LAST YEAR
<span class="pull-right"><b>4 225</b> <small>TICKETS</small></span>
</li>
<li>
ALL
<span class="pull-right"><b>8 752</b> <small>TICKETS</small></span>
</li>
</ul>
</div>
</div>
</div>
<!-- #END# Answered Tickets -->
</div>
<div class="row clearfix">
<!-- Task Info -->
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
<div class="card">
<div class="header">
<h2>TASK INFOS</h2>
<ul class="header-dropdown m-r--5">
<li class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<i class="material-icons">more_vert</i>
</a>
<ul class="dropdown-menu pull-right">
<li><a href="javascript:void(0);">Action</a></li>
<li><a href="javascript:void(0);">Another action</a></li>
<li><a href="javascript:void(0);">Something else here</a></li>
</ul>
</li>
</ul>
</div>
<div class="body">
<div class="table-responsive">
<table class="table table-hover dashboard-task-infos">
<thead>
<tr>
<th>#</th>
<th>Task</th>
<th>Status</th>
<th>Manager</th>
<th>Progress</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Task A</td>
<td><span class="label bg-green">Doing</span></td>
<td>John Doe</td>
<td>
<div class="progress">
<div class="progress-bar bg-green" role="progressbar" aria-valuenow="62" aria-valuemin="0" aria-valuemax="100" style="width: 62%"></div>
</div>
</td>
</tr>
<tr>
<td>2</td>
<td>Task B</td>
<td><span class="label bg-blue">To Do</span></td>
<td>John Doe</td>
<td>
<div class="progress">
<div class="progress-bar bg-blue" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: 40%"></div>
</div>
</td>
</tr>
<tr>
<td>3</td>
<td>Task C</td>
<td><span class="label bg-light-blue">On Hold</span></td>
<td>John Doe</td>
<td>
<div class="progress">
<div class="progress-bar bg-light-blue" role="progressbar" aria-valuenow="72" aria-valuemin="0" aria-valuemax="100" style="width: 72%"></div>
</div>
</td>
</tr>
<tr>
<td>4</td>
<td>Task D</td>
<td><span class="label bg-orange">Wait Approvel</span></td>
<td>John Doe</td>
<td>
<div class="progress">
<div class="progress-bar bg-orange" role="progressbar" aria-valuenow="95" aria-valuemin="0" aria-valuemax="100" style="width: 95%"></div>
</div>
</td>
</tr>
<tr>
<td>5</td>
<td>Task E</td>
<td>
<span class="label bg-red">Suspended</span>
</td>
<td>John Doe</td>
<td>
<div class="progress">
<div class="progress-bar bg-red" role="progressbar" aria-valuenow="87" aria-valuemin="0" aria-valuemax="100" style="width: 87%"></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- #END# Task Info -->
<!-- Browser Usage -->
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="card">
<div class="header">
<h2>BROWSER USAGE</h2>
<ul class="header-dropdown m-r--5">
<li class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<i class="material-icons">more_vert</i>
</a>
<ul class="dropdown-menu pull-right">
<li><a href="javascript:void(0);">Action</a></li>
<li><a href="javascript:void(0);">Another action</a></li>
<li><a href="javascript:void(0);">Something else here</a></li>
</ul>
</li>
</ul>
</div>
<div class="body">
<div id="donut_chart" class="dashboard-donut-chart"></div>
</div>
</div>
</div>
<!-- #END# Browser Usage -->
<div>
<h2 class="text-center font-weight-normal">MOJE KONKURSY</h2>
</div>
</div>

View File

@ -1,12 +1,13 @@
import { Component, Injector, AfterViewInit } from '@angular/core';
import { Component, Injector, OnInit } from '@angular/core';
import { AppComponentBase } from '@shared/app-component-base';
import { appModuleAnimation } from '@shared/animations/routerTransition';
@Component({
templateUrl: './home.component.html',
styleUrls: ['./home.component.css'],
animations: [appModuleAnimation()]
})
export class HomeComponent extends AppComponentBase implements AfterViewInit {
export class HomeComponent extends AppComponentBase implements OnInit {
constructor(
injector: Injector
@ -14,122 +15,7 @@ export class HomeComponent extends AppComponentBase implements AfterViewInit {
super(injector);
}
ngAfterViewInit(): void {
public ngOnInit(): void {
$(function () {
//Widgets count
$('.count-to').countTo();
//Sales count to
$('.sales-count-to').countTo({
formatter: function (value, options) {
return '$' + value.toFixed(2).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, ' ').replace('.', ',');
}
});
initRealTimeChart();
initDonutChart();
initSparkline();
});
var realtime = 'on';
function initRealTimeChart() {
//Real time ==========================================================================================
var plot = ($ as any).plot('#real_time_chart', [getRandomData()], {
series: {
shadowSize: 0,
color: 'rgb(0, 188, 212)'
},
grid: {
borderColor: '#f3f3f3',
borderWidth: 1,
tickColor: '#f3f3f3'
},
lines: {
fill: true
},
yaxis: {
min: 0,
max: 100
},
xaxis: {
min: 0,
max: 100
}
});
function updateRealTime() {
plot.setData([getRandomData()]);
plot.draw();
var timeout;
if (realtime === 'on') {
timeout = setTimeout(updateRealTime, 320);
} else {
clearTimeout(timeout);
}
}
updateRealTime();
$('#realtime').on('change', function () {
realtime = (this as any).checked ? 'on' : 'off';
updateRealTime();
});
//====================================================================================================
}
function initSparkline() {
$(".sparkline").each(function () {
var $this = $(this);
$this.sparkline('html', $this.data());
});
}
function initDonutChart() {
((window as any).Morris).Donut({
element: 'donut_chart',
data: [{
label: 'Chrome',
value: 37
}, {
label: 'Firefox',
value: 30
}, {
label: 'Safari',
value: 18
}, {
label: 'Opera',
value: 12
},
{
label: 'Other',
value: 3
}],
colors: ['rgb(233, 30, 99)', 'rgb(0, 188, 212)', 'rgb(255, 152, 0)', 'rgb(0, 150, 136)', 'rgb(96, 125, 139)'],
formatter: function (y) {
return y + '%'
}
});
}
var data = [], totalPoints = 110;
function getRandomData() {
if (data.length > 0) data = data.slice(1);
while (data.length < totalPoints) {
var prev = data.length > 0 ? data[data.length - 1] : 50, y = prev + Math.random() * 10 - 5;
if (y < 0) { y = 0; } else if (y > 100) { y = 100; }
data.push(y);
}
var res = [];
for (var i = 0; i < data.length; ++i) {
res.push([i, data[i]]);
}
return res;
}
}
}

View File

@ -6,7 +6,6 @@ import { CompetitionDto } from '@shared/service-proxies/service-proxies';
export class FilterClassesPipe implements PipeTransform {
transform(allCompetitions: CompetitionDto[], args?: any) {
console.log(args);
let minClass = args[0];
let maxClass = args[1];
return allCompetitions

View File

@ -2671,7 +2671,7 @@ export interface ICreateRankingPositionDto {
}
export class RankingPositionDto implements IRankingPositionDto {
participantName: number | undefined;
participantName: string | undefined;
competitionId: number | undefined;
points: number | undefined;
id: number | undefined;
@ -2719,7 +2719,7 @@ export class RankingPositionDto implements IRankingPositionDto {
}
export interface IRankingPositionDto {
participantName: number | undefined;
participantName: string | undefined;
competitionId: number | undefined;
points: number | undefined;
id: number | undefined;

View File

@ -16,7 +16,7 @@ namespace SystemKonkursow.EntityFrameworkCore.Seed
public void Create()
{
if (null != _context.CompetitionCategories.FirstOrDefault())
if (null != _context.Categories.FirstOrDefault())
return;
CreateOneCategory("Matematyka");
@ -45,31 +45,32 @@ namespace SystemKonkursow.EntityFrameworkCore.Seed
Name = name
};
var competitions = new List<Domain.Competition> { };
//var competitions = new List<Domain.Competition> { };
for (int competitionId = 1; competitionId < CompetitionsNumber; competitionId++)
{
var exampleCompetition = new Domain.Competition
{
CreatorUserId = 3,
Name = name + " : konkurs nr " + competitionId,
StartDate = new DateTime(2019, rnd.Next(1, 4), rnd.Next(1, 29)),
EndDate = new DateTime(2019, rnd.Next(4, 7), rnd.Next(1, 31)),
Description = "Opis konkursu nr " + competitionId + " z kategorii: " + name,
Prize = "Opis nagród dla konkursu nr " + competitionId + " z kategorii: " + name,
MinClass = rnd.Next(1, 5),
MaxClass = rnd.Next(5, 9)
};
//for (int competitionId = 1; competitionId < CompetitionsNumber; competitionId++)
//{
// var exampleCompetition = new Domain.Competition
// {
// CreatorUserId = 3,
// Name = name + " : konkurs nr " + competitionId,
// StartDate = new DateTime(2019, rnd.Next(1, 4), rnd.Next(1, 29)),
// EndDate = new DateTime(2019, rnd.Next(4, 7), rnd.Next(1, 31)),
// Description = "Opis konkursu nr " + competitionId + " z kategorii: " + name,
// Prize = "Opis nagród dla konkursu nr " + competitionId + " z kategorii: " + name,
// MinClass = rnd.Next(1, 5),
// MaxClass = rnd.Next(5, 9)
// };
var exampleCompetitionCategory = new Domain.CompetitionCategory()
{
Category = exampleCategory,
Competition = exampleCompetition
};
// var exampleCompetitionCategory = new Domain.CompetitionCategory()
// {
// Category = exampleCategory,
// Competition = exampleCompetition
// };
_context.CompetitionCategories.Add(exampleCompetitionCategory);
}
// _context.CompetitionCategories.Add(exampleCompetitionCategory);
//}
_context.Categories.Add(exampleCategory);
_context.SaveChanges();
}

View File

@ -40,6 +40,7 @@ namespace SystemKonkursow.EntityFrameworkCore.Seed
});
CreateUser(new List<Role> { participantRole }, "Jerzy", "Nowak", "uczestnik", "uczestnik@example.com", true);
CreateUser(new List<Role> { participantRole }, "Piotr", "Lewandowski", "nowy_uczestnik", "nowy_uczestnik@example.com", true);
}
private Role CreateRole(string roleName, IList<string> permissionList)