Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into bugfix/fix-dwonload-text
Browse files Browse the repository at this point in the history
  • Loading branch information
HPunktOchs authored May 5, 2018
2 parents db5ffbc + 64e409e commit 774c8c1
Show file tree
Hide file tree
Showing 21 changed files with 71 additions and 25 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added an account activation resend feature. [#601](https://github.com/h-da/geli/issues/601)
- Added `SnackBarService` as wrapper for `MatSnackBar`. [#574](https://github.com/h-da/geli/issues/574)
- Added new course & user API unit tests. [#654](https://github.com/h-da/geli/issues/654) [#691](https://github.com/h-da/geli/issues/691)
- Added details of courseAdmin and teacher to course detail view. on click profiles are shown.[#598] (https://github.com/h-da/geli/issues/598)
- Added details of courseAdmin and teacher to course detail view. on click profiles are shown.[#598](https://github.com/h-da/geli/issues/598)
- Added small auto linting scripts to package.json [#688](https://github.com/h-da/geli/issues/688)
- Added changed size of drop down arrows for better usability. [#686] (https://github.com/h-da/geli/issues/686)
- Added changed size of drop down arrows for better usability. [#686](https://github.com/h-da/geli/issues/686)
- Added icon for access key [#547](https://github.com/h-da/geli/issues/574)

### Changed
- Refactored or slightly altered various course & user related APIs. [#654](https://github.com/h-da/geli/issues/654) [#691](https://github.com/h-da/geli/issues/691)
- Removed firstname from resend activation feature and change button positioning. [#711](https://github.com/h-da/geli/issues/711)
- Refactored register and resend activation to use geli email validator with top level domain check. [#713](https://github.com/h-da/geli/issues/713)
- Refactored the unitCreator with a forsafe user object. [#717](https://github.com/h-da/geli/pull/717)
- Changed the text in download course[#718](https://github.com/h-da/geli/pull/718)
- Removed firstname from resend activation feature and change button positioning. [#711](https://github.com/h-da/geli/issues/711)
- Refactored register and resend activation to use geli email validator with top level domain check. [#713](https://github.com/h-da/geli/issues/713)

### Fixed
- Fixed Course progress mechanism
Expand All @@ -36,6 +39,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Repair Angular CLI code generation. [#701](https://github.com/h-da/geli/pull/701)
- Fixed `tsconfig.spec.ts` for `ng test`. [#656](https://github.com/h-da/geli/pull/656)
- Fixed `.travis.yml`. [#706](https://github.com/h-da/geli/pull/706)
- Fixed wording of progress display on profile page. [#715](https://github.com/h-da/geli/issues/715)
- Fixed form validator in create task [#579](https://github.com/h-da/geli/issues/579)

### Added
- Unit visibility toggle [#582](https://github.com/h-da/geli/issues/582)

### Security
- Fixed numerous severe user related security issues. [#691](https://github.com/h-da/geli/issues/691) [#709](https://github.com/h-da/geli/pull/709)
Expand Down
1 change: 0 additions & 1 deletion api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions api/src/controllers/CourseController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,9 @@ export class CourseController {
@Authorized(['teacher', 'admin'])
@Post('/:id/whitelist')
async whitelistStudents(
@Param('id') id: string,
@UploadedFile('file', {options: uploadOptions}) file: any,
@CurrentUser() currentUser: IUser) {
@Param('id') id: string,
@UploadedFile('file', {options: uploadOptions}) file: any,
@CurrentUser() currentUser: IUser) {
const name: string = file.originalname;
if (!name.endsWith('.csv')) {
throw new TypeError(errorCodes.upload.type.notCSV.code);
Expand Down
4 changes: 2 additions & 2 deletions api/src/controllers/ReportController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,9 @@ export class ReportController {
.map(({courseObj, progressableUnitCount}: any) => {
const progressStats = this.calculateProgress(userProgressData, progressableUnitCount, courseObj);
courseObj.progressData = [
{ name: 'nothing', value: progressStats.nothing },
{ name: 'not tried', value: progressStats.nothing },
{ name: 'tried', value: progressStats.tried },
{ name: 'done', value: progressStats.done }
{ name: 'solved', value: progressStats.done }
];
return courseObj;
})
Expand Down
10 changes: 6 additions & 4 deletions api/src/models/Course.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ const courseSchema = new mongoose.Schema({
ref: 'User'
},
media:
{
type: mongoose.Schema.Types.ObjectId,
ref: 'Directory'
},
{
type: mongoose.Schema.Types.ObjectId,
ref: 'Directory'
},
teachers: [
{
type: mongoose.Schema.Types.ObjectId,
Expand Down Expand Up @@ -253,11 +253,13 @@ courseSchema.methods.forView = function (): ICourseView {
};

courseSchema.methods.populateLecturesFor = function (user: IUser) {
const isTeacherOrAdmin = (user.role === 'teacher' || user.role === 'admin');
return this.populate({
path: 'lectures',
populate: {
path: 'units',
virtuals: true,
match: {$or: [{visible: undefined}, {visible: true}, {visible: !isTeacherOrAdmin}]},
populate: {
path: 'progressData',
match: {user: {$eq: user._id}}
Expand Down
3 changes: 3 additions & 0 deletions api/src/models/units/Unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ const unitSchema = new mongoose.Schema({
type: {
type: String
},
visible: {
type: Boolean
},
unitCreator: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
Expand Down
1 change: 0 additions & 1 deletion app/webFrontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions app/webFrontend/src/app/course/course.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
{{course.description}}
</p>
</mat-card-content>
<mat-card-actions >
<span class="course-admin-actions" *ngIf="course.userCanEditCourse">
<mat-card-actions>
<span class="course-admin-actions" *ngIf="this.course.userCanEditCourse">
<button mat-icon-button (click)="editCourse(course._id)">
<mat-icon>mode_edit</mat-icon>
</button>
Expand All @@ -23,17 +23,23 @@
</button>
</span>
<span class="course-student-actions" *ngIf="this.userService.isStudent()">
<div style="float:left">
<i class="material-icons" style="margin-top: 8px;"
matTooltip="Key Required"
*ngIf="course.enrollType === 'accesskey'">lock</i>
<i class="material-icons" style="margin-top: 8px;"
matTooltip="No Key Required"
*ngIf="course.enrollType !== 'accesskey'">lock_open</i>
</div>
<button mat-icon-button *ngIf="!course.userIsCourseMember"
(click)="enroll()" matTooltip="Enroll">
<mat-icon>add_circle_outline</mat-icon>
</button>

<button mat-icon-button *ngIf="course.userIsCourseMember"
(click)="leave()" matTooltip="Leave">
<mat-icon>remove_circle_outline</mat-icon>
</button>
</span>

<button mat-mini-fab *ngIf="course.userCanViewCourse"
color="primary" class="details-button" [routerLink]="['course', course._id]">
<mat-icon>arrow_forward</mat-icon>
Expand Down
2 changes: 2 additions & 0 deletions app/webFrontend/src/app/models/units/CodeKataUnit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class CodeKataUnit implements ICodeKataUnit {
weight: number;
updatedAt: string;
createdAt: string;
visible: boolean;

definition: string;
code: string;
Expand All @@ -25,4 +26,5 @@ export class CodeKataUnit implements ICodeKataUnit {
this.weight = 0;
this.__t = 'code-kata';
}

}
2 changes: 2 additions & 0 deletions app/webFrontend/src/app/models/units/FileUnit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class FileUnit implements IFileUnit {
weight: number;
updatedAt: string;
createdAt: string;
visible: boolean;
unitCreator: any;

files: IFile[] = [];
Expand All @@ -25,4 +26,5 @@ export class FileUnit implements IFileUnit {
this.progressable = false;
this.weight = 0;
}

}
1 change: 1 addition & 0 deletions app/webFrontend/src/app/models/units/FreeTextUnit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class FreeTextUnit implements IFreeTextUnit {
__t: string;
progressable: boolean;
weight: number;
visible: boolean;
unitCreator: any;

markdown: string;
Expand Down
1 change: 1 addition & 0 deletions app/webFrontend/src/app/models/units/TaskUnit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class TaskUnit implements ITaskUnit {
__t: string;
progressable: boolean;
weight: number;
visible: boolean;
unitCreator: any;

tasks: ITask[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export class CodeKataUnitFormComponent implements OnInit {
name: this.generalInfo.form.value.name,
description: this.generalInfo.form.value.description,
deadline: this.generalInfo.form.value.deadline,
visible: this.generalInfo.form.value.visible
};

if (this.model._id === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export class FileUnitFormComponent implements OnInit {
this.model = {
...this.model,
name: this.generalInfo.form.value.name,
description: this.generalInfo.form.value.description
description: this.generalInfo.form.value.description,
visible: this.generalInfo.form.value.visible

};

const reqObj = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export class FreeTextUnitFormComponent implements OnInit {
...this.model,
name: this.generalInfo.form.value.name,
description: this.generalInfo.form.value.description,
visible: this.generalInfo.form.value.visible,

markdown: this.freeTextEditor.markdown
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div *ngFor="let task of model.tasks" class="question-answer">
<mat-form-field matLine class="question">
<textarea matInput id="name" placeholder="Enter question here" [(ngModel)]="task.name"></textarea>
<textarea matInput id="name" placeholder="Enter question here *" [(ngModel)]="task.name"></textarea>
</mat-form-field>

<button mat-button class="remove" (click)="removeTask(task)">
Expand All @@ -21,7 +21,7 @@
<div class="check-answer">
<mat-checkbox [(ngModel)]="answer.value" name="value_{{idx}}"></mat-checkbox>
<mat-form-field>
<input matInput placeholder="Enter answer here" [(ngModel)]="answer.text">
<input matInput placeholder="Enter answer here *" [(ngModel)]="answer.text">
</mat-form-field>
<button mat-button class="remove" (click)="removeAnswer(task, idx)" matTooltip="Remove answer">
<mat-icon>delete</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class TaskUnitEditComponent implements OnInit {
name: this.generalInfo.form.value.name,
description: this.generalInfo.form.value.description,
deadline: this.generalInfo.form.value.deadline,
visible: this.generalInfo.form.value.visible
};

if (this.isTaskUnitValid()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,11 @@
<mat-datepicker-toggle matSuffix [for]="deadlineDatepicker"></mat-datepicker-toggle>
<mat-datepicker #deadlineDatepicker (selectedChanged)="updateDateTime($event)"></mat-datepicker>
</mat-form-field>

<div>
<mat-slide-toggle formControlName="visible">
<span *ngIf="form.value.visible">Unit can be seen by students</span>
<span *ngIf="!form.value.visible">Unit cannot be seen by students</span>
</mat-slide-toggle>
</div>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ export class UnitGeneralInfoFormComponent implements OnInit {
}

ngOnInit() {
if (this.model !== null && this.model !== undefined && this.model.visible === undefined) {
this.model.visible = true;
}
this.form = this.formBuilder.group({
name: [this.model ? this.model.name : '', Validators.required],
description: [this.model ? this.model.description : '', Validators.required],
deadline: [this.model ? this.model.deadline : '']
description: [this.model ? this.model.description : ''],
deadline: [this.model ? this.model.deadline : ''],
visible: [this.model ? this.model.visible : false]
});
}

Expand Down
11 changes: 8 additions & 3 deletions app/webFrontend/src/app/unit/unit.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<div *ngFor="let unit of units;">
<mat-card class="unit-card">
<button mat-icon-button *ngIf="unit.visible === false" disabled>
<mat-icon color="warn">visibility_off</mat-icon>
</button>
<mat-card-title class="unit-card-title">
{{unit.name}}
</mat-card-title>
Expand All @@ -19,9 +22,11 @@
<app-code-kata *ngSwitchCase="'code-kata'" [codeKataUnit]="unit"></app-code-kata>
<app-free-text-unit *ngSwitchCase="'free-text'" [freeTextUnit]="unit"></app-free-text-unit>
<div class="unit-detail">
<div class="user-detail" *ngIf="unit.unitCreator">{{unit.unitCreator.profile.firstName + ' ' + unit.unitCreator.profile.lastName}}</div>
<span *ngIf="unit.createdAt === unit.updatedAt">Published on: {{getFormattedDate(unit.createdAt)}}</span>
<span *ngIf="unit.createdAt !== unit.updatedAt">Changed on: {{getFormattedDate(unit.updatedAt)}}</span>
<div class="user-detail" *ngIf="unit.unitCreator">{{unit.unitCreator.profile.firstName + ' ' +
unit.unitCreator.profile.lastName}}
</div>
<span *ngIf="unit.createdAt === unit.updatedAt">Published on: {{getFormattedDate(unit.createdAt)}}</span>
<span *ngIf="unit.createdAt !== unit.updatedAt">Changed on: {{getFormattedDate(unit.updatedAt)}}</span>
</div>
</mat-card-content>
</mat-card>
Expand Down
1 change: 1 addition & 0 deletions shared/models/units/IUnit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ export interface IUnit {
updatedAt: string;
createdAt: string;
unitCreator: IUser;
visible: boolean;
__t: string;
}

0 comments on commit 774c8c1

Please sign in to comment.