Skip to content

Commit

Permalink
Merge branch 'master' into TEAMMATES#12508-reset-rubric-question-subm…
Browse files Browse the repository at this point in the history
…ission
  • Loading branch information
Mex7180 authored Sep 25, 2023
2 parents 1b25802 + fe6a397 commit eb1c941
Show file tree
Hide file tree
Showing 22 changed files with 3,476 additions and 2,512 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void testAll() {
______TS("delete student");
detailsPage.sortByName();
detailsPage.sortByStatus();
StudentAttributes[] studentsAfterDelete = { students[3], students[0], students[1] };
StudentAttributes[] studentsAfterDelete = { students[0], students[3], students[1] };
detailsPage.deleteStudent(student);

detailsPage.verifyStatusMessage("Student is successfully deleted from course \""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ exports[`ExtensionConfirmModalComponent should snap with the extended students a
[email protected]
</td>
<td>
5 Apr 2000 2:00:00
<span>
5 Apr 2000 2:00:00
</span>
</td>
</tr>
<tr>
Expand All @@ -221,7 +223,9 @@ exports[`ExtensionConfirmModalComponent should snap with the extended students a
[email protected]
</td>
<td>
5 Apr 2000 2:00:00
<span>
5 Apr 2000 2:00:00
</span>
</td>
</tr>
<tr>
Expand All @@ -238,7 +242,9 @@ exports[`ExtensionConfirmModalComponent should snap with the extended students a
[email protected]
</td>
<td>
5 Apr 2000 2:00:00
<span>
5 Apr 2000 2:00:00
</span>
</td>
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ <h5>Or</h5>
</div>
<div class="row text-center align-items-center">
<div id="submission-start-date" class="col-md-7 col-xs-center">
<tm-datepicker [isDisabled]="!model.isEditable" (dateChangeCallback)="triggerModelChange('submissionStartDate', $event)"
<tm-datepicker [isDisabled]="!model.isEditable" (dateChangeCallback)="triggerSubmissionOpeningDateModelChange('submissionStartDate', $event)"
[minDate]="minDateForSubmissionStart" [maxDate]="maxDateForSubmissionStart"
[date]="model.submissionStartDate"></tm-datepicker>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { TimeFormat } from 'src/web/types/datetime-const';
import { TeammatesRouterModule } from '../teammates-router/teammates-router.module';
import { SessionEditFormComponent } from './session-edit-form.component';
import { SessionEditFormModule } from './session-edit-form.module';
Expand Down Expand Up @@ -30,4 +31,26 @@ describe('SessionEditFormComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});

it('should configure the time to be 23:59 if the hour is 23 and minute is greater than 0', () => {
const time : TimeFormat = { hour: 23, minute: 5 };
component.configureSubmissionOpeningTime(time);
expect(time.hour).toEqual(23);
expect(time.minute).toEqual(59);
});

it('should configure the time correctly if the hour is less than 23 and minute is greater than 0', () => {
const time : TimeFormat = { hour: 22, minute: 5 };
component.configureSubmissionOpeningTime(time);
expect(time.hour).toEqual(23);
expect(time.minute).toEqual(0);
});

it('should configure the time correctly if the minute is 0', () => {
const time : TimeFormat = { hour: 21, minute: 0 };
component.configureSubmissionOpeningTime(time);
expect(time.hour).toEqual(21);
expect(time.minute).toEqual(0);
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,36 @@ export class SessionEditFormComponent {
});
}

/**
* Triggers the change of the model when the submission opening date changes.
*/
triggerSubmissionOpeningDateModelChange(field: string, date: DateFormat): void {
const minDate: DateFormat = this.minDateForSubmissionStart;
const minTime: TimeFormat = this.minTimeForSubmissionStart;

// Case where date is same as earliest date and time is earlier than earliest possible time
if (DateTimeService.compareDateFormat(date, minDate) === 0
&& DateTimeService.compareTimeFormat(this.model.submissionStartTime, minTime) === -1) {
this.configureSubmissionOpeningTime(minTime);
this.model.submissionStartTime = minTime;
}

this.triggerModelChange(field, date);
}

/**
* Configures the time for the submission opening time.
*/
configureSubmissionOpeningTime(time : TimeFormat) : void {
if (time.hour === 23 && time.minute > 0) {
time.minute = 59;
} else if (time.hour < 23 && time.minute > 0) {
// Case where minutes is not 0 since the earliest time with 0 minutes is the hour before
time.hour += 1;
time.minute = 0;
}
}

/**
* Handles course Id change event.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<table class="table table-bordered table-striped">
<thead>
<tr [ngClass]="{ 'bg-primary': setMainTableStyle, 'text-white': setMainTableStyle}">
<tr [ngClass]="setMainTableStyle ? 'bg-primary text-white' : customHeaderStyle">
<th *ngFor="let column of columns" [ngClass]="{ 'sortable-header': column.sortBy }" class="{{column?.headerClass}}"
[ngStyle]="getAlignment(column)" (click)="column.sortBy && onClickHeader(column.header)" [attr.aria-sort]="getAriaSort(column.header)"
>
Expand All @@ -25,7 +25,9 @@
[ngComponentOutlet]="item.customComponent.component"
[ndcDynamicInputs]="item.customComponent.componentData(idx)"
></ndc-dynamic>
<ng-container *ngIf="!item.customComponent && item.displayValue">{{ item.displayValue }}</ng-container>
<ng-container *ngIf="!item.customComponent && item.displayValue">
<span [innerHTML]="item.displayValue"></span>
</ng-container>
<ng-container *ngIf="!item.customComponent && !item.displayValue">{{ item.value }}</ng-container>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export enum SortableTableHeaderColorScheme {
* White background with black text.
*/
WHITE,

/**
* Custom background setting
*/
OTHERS,
}

/**
Expand Down Expand Up @@ -72,6 +77,9 @@ export class SortableTableComponent implements OnInit, OnChanges {
@Input()
headerColorScheme: SortableTableHeaderColorScheme = SortableTableHeaderColorScheme.BLUE;

@Input()
customHeaderStyle: string = '';

@Input()
columns: ColumnData[] = [];

Expand Down
Loading

0 comments on commit eb1c941

Please sign in to comment.