Skip to content

Commit

Permalink
Merge branch 'master' into feature/extend-deadline-for-not-responded-yet
Browse files Browse the repository at this point in the history
  • Loading branch information
undermyumbrella1 committed May 13, 2023
2 parents 3d6a997 + e19904b commit 4e788ae
Show file tree
Hide file tree
Showing 22 changed files with 816 additions and 485 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="row" *ngIf="logs.length>0; else noLogMessage">
<div class="row logs-table-container" *ngIf="logs.length>0; else noLogMessage">
<div class="col-12">
<table id="logs-table" class="table table-bordered table-hover margin-bottom-20px logs-table">
<thead>
Expand Down
9 changes: 9 additions & 0 deletions src/web/app/components/logs-table/logs-table.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
width: 100%;
word-break: break-all;
max-height: 90vh;
min-width: 1030px;

thead {
flex: 0 0 auto;
Expand Down Expand Up @@ -98,3 +99,11 @@
width: 100%;
white-space: nowrap;
}

.logs-table-container {
div.col-12 {
padding-right: 0;
}

margin-right: 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ModifiedTimestampModalComponent should snap with coursesOfModifiedSession and modifiedSessions 1`] = `
<tm-modified-timestamps-modal
__ngContext__={[Function Number]}
coursesOfModifiedSession={[Function Array]}
modifiedSessions={[Function Object]}
>
<p>
The feedback session has been copied to all courses. However, changes are made to some session timings as the existing timings are no longer valid in these courses: CS315-Semester12023. The changes are as follows:
</p><table
class="table table-bordered"
>
<thead>
<tr>
<th>
Session Name
</th>
<th>
Timings
</th>
<th>
Existing
</th>
<th>
Modified
</th>
</tr>
</thead>
<tbody>
<tr>
<td
rowspan="4"
>
Instructor Feedback Session
</td>
<td>
Submission opening time
</td>
<td>
22 Mar 2023 9:00 PM
</td>
<td>
23 Apr 2023 9:00 PM
</td>
</tr>
<tr>
<td>
Submission closing time
</td>
<td>
31 Mar 2023 11:59 PM
</td>
<td>
27 Apr 2023 11:59 PM
</td>
</tr>
<tr
class="text-color-lightgray"
>
<td>
Session visible time
</td>
<td>
On submission opening time
</td>
<td>
On submission opening time
</td>
</tr>
<tr
class="text-color-lightgray"
>
<td>
Response visible time
</td>
<td>
Not now (publish manually)
</td>
<td>
Not now (publish manually)
</td>
</tr>
</tbody>
</table><br /><p>
Please modify the timings as necessary.
</p>
</tm-modified-timestamps-modal>
`;

exports[`ModifiedTimestampModalComponent should snap with default fields 1`] = `
<tm-modified-timestamps-modal
__ngContext__={[Function Number]}
coursesOfModifiedSession={[Function Array]}
modifiedSessions={[Function Object]}
>
<p>
The course has been added. However, changes are made to some session timings as the existing timings are no longer valid. The changes are as follows:
</p><table
class="table table-bordered"
>
<thead>
<tr>
<th>
Session Name
</th>
<th>
Timings
</th>
<th>
Existing
</th>
<th>
Modified
</th>
</tr>
</thead>
<tbody>
</tbody>
</table><br /><p>
Please modify the timings as necessary.
</p>
</tm-modified-timestamps-modal>
`;

exports[`ModifiedTimestampModalComponent should snap with modifiedSessions 1`] = `
<tm-modified-timestamps-modal
__ngContext__={[Function Number]}
coursesOfModifiedSession={[Function Array]}
modifiedSessions={[Function Object]}
>
<p>
The course has been added. However, changes are made to some session timings as the existing timings are no longer valid. The changes are as follows:
</p><table
class="table table-bordered"
>
<thead>
<tr>
<th>
Session Name
</th>
<th>
Timings
</th>
<th>
Existing
</th>
<th>
Modified
</th>
</tr>
</thead>
<tbody>
<tr>
<td
rowspan="4"
>
Instructor Feedback Session
</td>
<td>
Submission opening time
</td>
<td>
22 Mar 2023 9:00 PM
</td>
<td>
23 Apr 2023 9:00 PM
</td>
</tr>
<tr>
<td>
Submission closing time
</td>
<td>
31 Mar 2023 11:59 PM
</td>
<td>
27 Apr 2023 11:59 PM
</td>
</tr>
<tr
class="text-color-lightgray"
>
<td>
Session visible time
</td>
<td>
On submission opening time
</td>
<td>
On submission opening time
</td>
</tr>
<tr
class="text-color-lightgray"
>
<td>
Response visible time
</td>
<td>
Not now (publish manually)
</td>
<td>
Not now (publish manually)
</td>
</tr>
</tbody>
</table><br /><p>
Please modify the timings as necessary.
</p>
</tm-modified-timestamps-modal>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<p *ngIf="coursesOfModifiedSession.length !== 0">
The feedback session has been copied to all courses. However, changes are made to some session timings as the
existing timings are no longer valid in these courses: {{ this.coursesOfModifiedSession.join(', ') }}.
The changes are as follows:
</p>
<p *ngIf="coursesOfModifiedSession.length === 0">
The course has been added. However, changes are made to some session timings as the existing timings are
no longer valid. The changes are as follows:
</p>
<table class="table table-bordered">
<thead>
<tr>
<th>Session Name</th>
<th>Timings</th>
<th>Existing</th>
<th>Modified</th>
</tr>
</thead>
<tbody>
<ng-container *ngFor="let session of this.modifiedSessions | keyvalue">
<tr
[ngClass]="{'text-color-lightgray' : session.value.oldTimestamp.submissionStartTimestamp === session.value.newTimestamp.submissionStartTimestamp}">
<td rowspan="4">{{ session.key }}</td>
<td>Submission opening time</td>
<td>{{ session.value.oldTimestamp.submissionStartTimestamp }}</td>
<td>{{ session.value.newTimestamp.submissionStartTimestamp }}</td>
</tr>
<tr
[ngClass]="{'text-color-lightgray' : session.value.oldTimestamp.submissionEndTimestamp === session.value.newTimestamp.submissionEndTimestamp}">
<td>Submission closing time</td>
<td>{{ session.value.oldTimestamp.submissionEndTimestamp }}</td>
<td>{{ session.value.newTimestamp.submissionEndTimestamp }}</td>
</tr>
<tr
[ngClass]="{'text-color-lightgray' : session.value.oldTimestamp.sessionVisibleTimestamp === session.value.newTimestamp.sessionVisibleTimestamp}">
<td>Session visible time</td>
<td>{{ session.value.oldTimestamp.sessionVisibleTimestamp }}</td>
<td>{{ session.value.newTimestamp.sessionVisibleTimestamp }}</td>
</tr>
<tr
[ngClass]="{'text-color-lightgray' : session.value.oldTimestamp.responseVisibleTimestamp === session.value.newTimestamp.responseVisibleTimestamp}">
<td>Response visible time</td>
<td>{{ session.value.oldTimestamp.responseVisibleTimestamp }}</td>
<td>{{ session.value.newTimestamp.responseVisibleTimestamp }}</td>
</tr>
</ng-container>
</tbody>
</table>
<br>
<p>
Please modify the timings as necessary.
</p>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { TweakedTimestampData } from '../../pages-instructor/instructor-session-base-page.component';
import { ModifiedTimestampModalComponent } from './modified-timestamps-modal.component';

describe('ModifiedTimestampModalComponent', () => {
let component: ModifiedTimestampModalComponent;
let fixture: ComponentFixture<ModifiedTimestampModalComponent>;

const coursesOfModifiedSession: string[] = [
'CS315-Semester12023',
];

const modifiedSessions: Record<string, TweakedTimestampData> = {
'Instructor Feedback Session': {
newTimestamp: {
submissionStartTimestamp: '23 Apr 2023 9:00 PM',
submissionEndTimestamp: '27 Apr 2023 11:59 PM',
sessionVisibleTimestamp: 'On submission opening time',
responseVisibleTimestamp: 'Not now (publish manually)',
},
oldTimestamp: {
submissionStartTimestamp: '22 Mar 2023 9:00 PM',
submissionEndTimestamp: '31 Mar 2023 11:59 PM',
sessionVisibleTimestamp: 'On submission opening time',
responseVisibleTimestamp: 'Not now (publish manually)',
},
},
};

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ModifiedTimestampModalComponent],
})
.compileComponents();

fixture = TestBed.createComponent(ModifiedTimestampModalComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});

it('should snap with default fields', () => {
expect(fixture).toMatchSnapshot();
});

it('should snap with coursesOfModifiedSession and modifiedSessions', () => {
component.coursesOfModifiedSession = coursesOfModifiedSession;
component.modifiedSessions = modifiedSessions;
fixture.detectChanges();

expect(fixture).toMatchSnapshot();
});

it('should snap with modifiedSessions', () => {
component.modifiedSessions = modifiedSessions;
fixture.detectChanges();

expect(fixture).toMatchSnapshot();
});

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Component, Input } from '@angular/core';
import { TweakedTimestampData } from '../../pages-instructor/instructor-session-base-page.component';

@Component({
selector: 'tm-modified-timestamps-modal',
templateUrl: './modified-timestamps-modal.component.html',
styleUrls: ['./modified-timestamps-modal.component.scss'],
})
export class ModifiedTimestampModalComponent {
@Input()
coursesOfModifiedSession: string[] = [];
@Input()
modifiedSessions: Record<string, TweakedTimestampData> = {};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { ModifiedTimestampModalComponent } from './modified-timestamps-modal.component';

/**
* Module for instructor home page.
*/
@NgModule({
declarations: [
ModifiedTimestampModalComponent,
],
imports: [
CommonModule,
],
exports: [
ModifiedTimestampModalComponent,
],
})
export class ModifiedTimestampModalModule { }
Loading

0 comments on commit 4e788ae

Please sign in to comment.