Merge branch 'master' of https://git.wmi.amu.edu.pl/s416178/Punktonerzy
This commit is contained in:
commit
cb4d85fd89
@ -57,12 +57,12 @@
|
|||||||
[contentStyle]="{'min-height':'600px', 'min-width': '800px'}">
|
[contentStyle]="{'min-height':'600px', 'min-width': '800px'}">
|
||||||
<div *ngIf="dataToDisplay === 'testów'">
|
<div *ngIf="dataToDisplay === 'testów'">
|
||||||
Od kiedy test ma być dostępny:
|
Od kiedy test ma być dostępny:
|
||||||
<p-calendar [(ngModel)]="dateFrom" [showTime]="true"></p-calendar >
|
<p-calendar [minDate]="minDate" [(ngModel)]="dateFrom" [showTime]="true"></p-calendar>
|
||||||
<br /><br /><br />
|
<br /><br /><br />
|
||||||
Ile minut ma być dostępny ten test:
|
Ile minut ma być dostępny ten test:
|
||||||
<input type="number" step="1" min="1" name="howLong" [(ngModel)]="howLong" />
|
<input type="number" step="1" min="1" name="howLong" [(ngModel)]="howLong" />
|
||||||
<br /><br /><br />
|
<br /><br /><br />
|
||||||
<button class="button" (click)="editTestAvailability()">Edytuj</button>
|
<button [disabled]="howLong < 1" class="button" (click)="editTestAvailability()">Edytuj</button>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="dataToDisplay !== 'testów'">
|
<div *ngIf="dataToDisplay !== 'testów'">
|
||||||
Ta funkcjonalność pozwala tylko na edycję dostępności testów.
|
Ta funkcjonalność pozwala tylko na edycję dostępności testów.
|
||||||
|
@ -31,14 +31,17 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
displayAvailability = false;
|
displayAvailability = false;
|
||||||
|
|
||||||
dateFrom: Date;
|
dateFrom: Date = new Date();
|
||||||
howLong = 10;
|
howLong = 10;
|
||||||
testId = 1;
|
testId = 1;
|
||||||
|
|
||||||
|
minDate: Date = new Date();
|
||||||
|
|
||||||
columnDefs = [
|
columnDefs = [
|
||||||
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
||||||
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
||||||
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.', hide: false },
|
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.', hide: false },
|
||||||
|
{ headerName: 'Start', field: 'startDate', headerTooltip: 'Start' },
|
||||||
{
|
{
|
||||||
headerName: '',
|
headerName: '',
|
||||||
suppressMenu: true,
|
suppressMenu: true,
|
||||||
@ -46,6 +49,9 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
cellRenderer: this.customCellRendererFunc
|
cellRenderer: this.customCellRendererFunc
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
timetest: number;
|
||||||
|
|
||||||
|
timeout: any;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private groupService: GroupsService, private router: Router,
|
constructor(private route: ActivatedRoute, private groupService: GroupsService, private router: Router,
|
||||||
public snackBar: MatSnackBar) { }
|
public snackBar: MatSnackBar) { }
|
||||||
@ -88,6 +94,7 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
this.snackBar.open('Prawidłowo edytowano przedział czasowy.', null,
|
this.snackBar.open('Prawidłowo edytowano przedział czasowy.', null,
|
||||||
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-success'] });
|
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-success'] });
|
||||||
this.displayAvailability = false;
|
this.displayAvailability = false;
|
||||||
|
this.isDisplayed('testów');
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.snackBar.open('Wystąpił błąd serwera. Spróbuj ponownie później.', null,
|
this.snackBar.open('Wystąpił błąd serwera. Spróbuj ponownie później.', null,
|
||||||
@ -119,8 +126,16 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
public onRowClicked(e) {
|
public onRowClicked(e) {
|
||||||
if (e.event.target !== undefined) {
|
if (e.event.target !== undefined) {
|
||||||
const data = e.data;
|
const data = e.data;
|
||||||
|
const now1 = new Date();
|
||||||
|
const now = now1.getTime();
|
||||||
const actionType = e.event.target.getAttribute('data-action-type');
|
const actionType = e.event.target.getAttribute('data-action-type');
|
||||||
|
const temp = new Date(data['dateFrom']);
|
||||||
|
const timetest = temp.getTime();
|
||||||
|
const tempstop = new Date(data['dateTo']);
|
||||||
|
const timeteststop = tempstop.getTime();
|
||||||
|
const currentUsername = JSON.parse(localStorage.getItem('currentUser')).username;
|
||||||
|
const groupOwnerUsername = localStorage.getItem('groupOwnerUsername');
|
||||||
|
if ((groupOwnerUsername === currentUsername) || (timetest < now && now < timeteststop)) {
|
||||||
switch (actionType) {
|
switch (actionType) {
|
||||||
case 'remove':
|
case 'remove':
|
||||||
return this.onActionRemoveClick(e);
|
return this.onActionRemoveClick(e);
|
||||||
@ -129,9 +144,25 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
default:
|
default:
|
||||||
this.goTo(e);
|
this.goTo(e);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
switch (actionType) {
|
||||||
|
case 'remove':
|
||||||
|
return this.onActionRemoveClick(e);
|
||||||
|
case 'edit':
|
||||||
|
return this.showAvailabilityDialog(e.data);
|
||||||
|
default:
|
||||||
|
this.noTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
noTime() {
|
||||||
|
this.snackBar.open('Test jest nieaktywny.', null,
|
||||||
|
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-error'] });
|
||||||
|
}
|
||||||
|
|
||||||
goTo(event: RowDoubleClickedEvent) {
|
goTo(event: RowDoubleClickedEvent) {
|
||||||
if (this.dataToDisplay === 'fiszek') {
|
if (this.dataToDisplay === 'fiszek') {
|
||||||
this.router.navigate(['flashcards/sets', event.data.id]);
|
this.router.navigate(['flashcards/sets', event.data.id]);
|
||||||
@ -201,11 +232,37 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onGridSizeChanged(params) {
|
onGridSizeChanged(params) {
|
||||||
|
const currentUsername = JSON.parse(localStorage.getItem('currentUser')).username;
|
||||||
|
const groupOwnerUsername = localStorage.getItem('groupOwnerUsername');
|
||||||
if (params.clientWidth < 800) {
|
if (params.clientWidth < 800) {
|
||||||
|
if (groupOwnerUsername === currentUsername) {
|
||||||
this.columnDefs = [
|
this.columnDefs = [
|
||||||
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
||||||
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
||||||
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.', hide: true },
|
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.', hide: true },
|
||||||
|
{ headerName: 'Start', field: 'startDate', headerTooltip: 'Start'},
|
||||||
|
{
|
||||||
|
headerName: '',
|
||||||
|
suppressMenu: true,
|
||||||
|
suppressSorting: true,
|
||||||
|
cellRenderer: this.customCellRendererFunc
|
||||||
|
}
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
this.columnDefs = [
|
||||||
|
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
||||||
|
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
||||||
|
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.', hide: true },
|
||||||
|
{ headerName: 'Start', field: 'startDate', headerTooltip: 'Start'},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (groupOwnerUsername === currentUsername) {
|
||||||
|
this.columnDefs = [
|
||||||
|
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
||||||
|
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
||||||
|
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.' },
|
||||||
|
{ headerName: 'Start', field: 'startDate', headerTooltip: 'Start'},
|
||||||
{
|
{
|
||||||
headerName: '',
|
headerName: '',
|
||||||
suppressMenu: true,
|
suppressMenu: true,
|
||||||
@ -218,14 +275,10 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
{ headerName: 'Nazwa', field: 'title', headerTooltip: 'Nazwa' },
|
||||||
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
{ headerName: 'Ocena', field: 'grade', headerTooltip: 'Ocena' },
|
||||||
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.' },
|
{ headerName: 'Max.', field: 'maxScore', headerTooltip: 'Max.' },
|
||||||
{
|
{ headerName: 'Start', field: 'startDate', headerTooltip: 'Start'}
|
||||||
headerName: '',
|
|
||||||
suppressMenu: true,
|
|
||||||
suppressSorting: true,
|
|
||||||
cellRenderer: this.customCellRendererFunc
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
params.api.sizeColumnsToFit();
|
params.api.sizeColumnsToFit();
|
||||||
}
|
}
|
||||||
@ -275,8 +328,30 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
if (resource === 'testów') {
|
if (resource === 'testów') {
|
||||||
this.localeText.noRowsToShow = 'Brak testów do wyświetlenia';
|
this.localeText.noRowsToShow = 'Brak testów do wyświetlenia';
|
||||||
setTimeout(() => {
|
if (this.timeout) {
|
||||||
this.testsSubscription = this.groupService.getResource(this.id, 'tests').subscribe(data => this.data = data);
|
clearTimeout(this.timeout);
|
||||||
|
}
|
||||||
|
this.timeout = setTimeout(() => {
|
||||||
|
this.testsSubscription = this.groupService.getResource(this.id, 'tests').subscribe(data => {
|
||||||
|
this.data = data;
|
||||||
|
data.forEach(x => {
|
||||||
|
const temp = new Date(x['dateFrom']);
|
||||||
|
const tempstop = new Date(x['dateTo']);
|
||||||
|
x['startDate'] = '';
|
||||||
|
const hours = temp.getHours();
|
||||||
|
const minutes = temp.getMinutes();
|
||||||
|
// const months = ['STY', 'LUT', 'MAR', 'KWI', 'MAJ', 'CZE', 'LIP', 'SIE', 'WRZ', 'PAŹ', 'LIS', 'GRU'];
|
||||||
|
const year = temp.getFullYear().toString().substring(2);
|
||||||
|
const monthTemp = (temp.getMonth() + 1);
|
||||||
|
let month = monthTemp.toString();
|
||||||
|
if (monthTemp < 10) {
|
||||||
|
month = `0${monthTemp}`;
|
||||||
|
}
|
||||||
|
const date = temp.getDate();
|
||||||
|
const time = date + '.' + month + '.' + year + ' ' + hours + ':' + minutes;
|
||||||
|
x['startDate'] += time;
|
||||||
|
});
|
||||||
|
});
|
||||||
this.dataToDisplay = resource;
|
this.dataToDisplay = resource;
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
|
@ -28,13 +28,13 @@
|
|||||||
<div *ngIf="testsToAdd.length > 0">
|
<div *ngIf="testsToAdd.length > 0">
|
||||||
<br /><br />
|
<br /><br />
|
||||||
Od kiedy test ma być dostępny:
|
Od kiedy test ma być dostępny:
|
||||||
<p-calendar [(ngModel)]="dateFrom" [showTime]="true"></p-calendar>
|
<p-calendar [(ngModel)]="dateFrom" [minDate]="minDate" [showTime]="true"></p-calendar>
|
||||||
<br /><br /><br />
|
<br /><br /><br />
|
||||||
Ile minut ma być dostępny ten test:
|
Ile minut ma być dostępny ten test:
|
||||||
<input type="number" step="1" min="1" name="howLong" [(ngModel)]="howLong" />
|
<input type="number" step="1" min="1" name="howLong" [(ngModel)]="howLong" />
|
||||||
</div>
|
</div>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<button [disabled]="selected.length === 0" class="button mr-1" (click)="addResources()"><i class="fas fa-check-circle"></i> Dodaj</button>
|
<button [disabled]="(selected.length === 0) && (howLong < 1)" class="button mr-1" (click)="addResources()"><i class="fas fa-check-circle"></i> Dodaj</button>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!(materialsToAdd.length > 0 || flashcardsToAdd.length > 0 || testsToAdd.length > 0)">
|
<div *ngIf="!(materialsToAdd.length > 0 || flashcardsToAdd.length > 0 || testsToAdd.length > 0)">
|
||||||
Brak elementów do dodania
|
Brak elementów do dodania
|
||||||
|
@ -15,9 +15,9 @@ import { Subscription } from 'rxjs/Subscription';
|
|||||||
export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
|
export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
public id = 0;
|
public id = 0;
|
||||||
public dateFrom: Date;
|
public dateFrom: Date = new Date();
|
||||||
public howLong = 10;
|
public howLong = 10;
|
||||||
public maxDate = new Date();
|
public minDate = new Date();
|
||||||
|
|
||||||
public materialsToAdd: Resource[] = [];
|
public materialsToAdd: Resource[] = [];
|
||||||
public testsToAdd: Resource[] = [];
|
public testsToAdd: Resource[] = [];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#container-small {
|
#container-small {
|
||||||
background-color: #181616;
|
background-color: #28102f;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
width: 25%;
|
width: 25%;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
@ -10,7 +10,7 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
#container-login {
|
#container-login {
|
||||||
background-color: #181616;
|
background-color: #28102f;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
|
@ -34,3 +34,10 @@
|
|||||||
.align {
|
.align {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.check
|
||||||
|
{
|
||||||
|
height: 35px;
|
||||||
|
width: 35px;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
<input type="number" step="1" min="0" name="time" class="form-control" [(ngModel)]="time" required/>
|
<input type="number" step="1" min="0" name="time" class="form-control" [(ngModel)]="time" required/>
|
||||||
</label>
|
</label>
|
||||||
<br />
|
<br />
|
||||||
|
<label class="block">
|
||||||
|
<input type="checkbox" name="{{ help }}" class ="check" [checked]="help" (change)="changeHelp()"/> <p> Zezwól na skorzystanie z koła ratunkowego</p>
|
||||||
|
</label>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
<p>Wpisz możliwe odpowiedzi i zaznacz prawidłową:</p>
|
<p>Wpisz możliwe odpowiedzi i zaznacz prawidłową:</p>
|
||||||
<div>
|
<div>
|
||||||
<div *ngFor="let answer of answersCorrect; let i = index" class="row">
|
<div *ngFor="let answer of answersCorrect; let i = index" class="row">
|
||||||
|
@ -12,6 +12,7 @@ export class SingleChoiceQuestionComponent implements OnInit {
|
|||||||
@Input() edit: Boolean;
|
@Input() edit: Boolean;
|
||||||
|
|
||||||
isChecked: Boolean = false;
|
isChecked: Boolean = false;
|
||||||
|
help: Boolean = false;
|
||||||
answers: Array<Object> = [];
|
answers: Array<Object> = [];
|
||||||
answersCorrect: Array<Object> = [];
|
answersCorrect: Array<Object> = [];
|
||||||
newAttribute: any = {
|
newAttribute: any = {
|
||||||
@ -45,6 +46,7 @@ export class SingleChoiceQuestionComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.points = this.content['content']['points'];
|
this.points = this.content['content']['points'];
|
||||||
|
this.help = this.content['content']['help'];
|
||||||
} else {
|
} else {
|
||||||
this.content = {};
|
this.content = {};
|
||||||
this.content['content'] = {
|
this.content['content'] = {
|
||||||
@ -53,7 +55,8 @@ export class SingleChoiceQuestionComponent implements OnInit {
|
|||||||
question: '',
|
question: '',
|
||||||
answers: [],
|
answers: [],
|
||||||
points: 1,
|
points: 1,
|
||||||
time: 0
|
time: 0,
|
||||||
|
help: this.help
|
||||||
};
|
};
|
||||||
this.content['edit'] = false;
|
this.content['edit'] = false;
|
||||||
}
|
}
|
||||||
@ -110,6 +113,10 @@ export class SingleChoiceQuestionComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeHelp(): void {
|
||||||
|
this.help = !this.help;
|
||||||
|
}
|
||||||
|
|
||||||
addTable(): void {
|
addTable(): void {
|
||||||
if ((this.question === undefined) || (this.question.trim().length === 0)) {
|
if ((this.question === undefined) || (this.question.trim().length === 0)) {
|
||||||
this.snackBar.open('Pytanie nie może być puste!', null,
|
this.snackBar.open('Pytanie nie może być puste!', null,
|
||||||
@ -161,6 +168,7 @@ export class SingleChoiceQuestionComponent implements OnInit {
|
|||||||
this.content['content']['answers'] = this.answers;
|
this.content['content']['answers'] = this.answers;
|
||||||
this.content['content']['points'] = this.points;
|
this.content['content']['points'] = this.points;
|
||||||
this.content['content']['time'] = this.time;
|
this.content['content']['time'] = this.time;
|
||||||
|
this.content['content']['help'] = this.help;
|
||||||
if (this.edit) {
|
if (this.edit) {
|
||||||
this.editing.emit(this.content);
|
this.editing.emit(this.content);
|
||||||
} else {
|
} else {
|
||||||
@ -189,6 +197,7 @@ export class SingleChoiceQuestionComponent implements OnInit {
|
|||||||
this.isChecked = false;
|
this.isChecked = false;
|
||||||
this.question = '';
|
this.question = '';
|
||||||
this.time = 0;
|
this.time = 0;
|
||||||
|
this.help = false;
|
||||||
this.answers = [];
|
this.answers = [];
|
||||||
this.answersCorrect = [];
|
this.answersCorrect = [];
|
||||||
this.newAttribute = {};
|
this.newAttribute = {};
|
||||||
|
@ -6,6 +6,12 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fifty
|
||||||
|
{
|
||||||
|
margin-right: auto;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.radio-answer
|
.radio-answer
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<form #f="ngForm" (ngSubmit)="nextQuestion(f)" novalidate>
|
<form #f="ngForm" (ngSubmit)="nextQuestion(f)" novalidate>
|
||||||
<div class="alert alert-grey question">
|
<div class="alert alert-grey question">
|
||||||
Pytanie za {{question.points}}pkt. <br /><span *ngIf="timeLeft > 0">Czas: {{ timeLeft }} sek. </span><span *ngIf="question.time === 0">Czas: bez limitu</span>
|
Pytanie za {{question.points}}pkt. <br /><span *ngIf="timeLeft > 0">Czas: {{ timeLeft }} sek. </span><span *ngIf="question.time === 0">Czas: bez limitu</span>
|
||||||
|
<div *ngIf="question.help" class="fifty"><img src="./././././assets/50-50.png" width="80px" height="50px"></div>
|
||||||
<div class="pytanie">{{question.question}} </div>
|
<div class="pytanie">{{question.question}} </div>
|
||||||
<div class="answers">
|
<div class="answers">
|
||||||
<div *ngFor="let item of question.answers" >
|
<div *ngFor="let item of question.answers" >
|
||||||
|
@ -162,7 +162,8 @@ export class TestMakerComponent implements OnInit {
|
|||||||
time: this.test[i]['content']['time'],
|
time: this.test[i]['content']['time'],
|
||||||
answers: this.test[i]['content']['answers'],
|
answers: this.test[i]['content']['answers'],
|
||||||
points: this.test[i]['content']['points'],
|
points: this.test[i]['content']['points'],
|
||||||
id: this.test[i]['content']['id']
|
id: this.test[i]['content']['id'],
|
||||||
|
help: this.test[i]['content']['help']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
toSend['body'] = body;
|
toSend['body'] = body;
|
||||||
|
BIN
FrontEnd/src/assets/50-50.png
Normal file
BIN
FrontEnd/src/assets/50-50.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 149 KiB |
Loading…
Reference in New Issue
Block a user