Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions web/src/app/components/create-survey/create-survey.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,12 @@ export class CreateSurveyComponent implements OnInit {
// Assume the survey exists.
const survey = this.survey!;

await this.taskService.addOrUpdateTasks(
survey.id,
// Assume there is at least one job.
survey.jobs.first(),
tasks!
);
const job = survey.jobs.first();
if (!job) {
console.error('Cannot save tasks: survey has no jobs', survey.id);
return;
}
await this.taskService.addOrUpdateTasks(survey.id, job, tasks!);
}

private async saveDataSharingTerms(): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ describe('DrawingToolsComponent', () => {
expect(
authServiceSpy.canUserAddPointsToJob(
mockSurvey,
mockSurvey.jobs.first()
mockSurvey.jobs.first()!
)
).toBe(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class DrawingToolsComponent implements OnInit, OnDestroy {
polygonValue = 'polygon';
selectedValue = '';
private lastSelectedValue = '';
selectedJobId = '';
selectedJobId: string | undefined = '';

readonly jobs = computed(() => {
const survey = this.survey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,7 @@ export class SubmissionFormComponent implements OnChanges {
task: Task,
result?: Result
): void {
const selectedOptionId = (
(result?.value as MultipleSelection)?.values.first() as Option
)?.id;
const selectedOptionId = (result?.value as MultipleSelection)?.values.first();
group[task.id] = task.required
? new FormControl(selectedOptionId, Validators.required)
: new FormControl(selectedOptionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('ShareListComponent', () => {
'title',
'description',
Map(),
Map({ [user.email]: Role.VIEWER }),
Map([[user.email, Role.VIEWER]]),
'owner-email',
{ type: DataSharingType.PRIVATE }
)
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/converters/loi-data-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function propertiesPbToModel(pb: {
properties[k] = v;
}
}
return Map(properties);
return Map(Object.entries(properties));
}

export function loiDocToModel(
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/converters/submission-data-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function taskDataPbArrayToModel(pb: Pb.ITaskData[]): SubmissionData {
}
});

return Map(submissionData);
return Map(Object.entries(submissionData));
}

function taskDataPbToModel(taskData: Pb.ITaskData): Result | null {
Expand Down
4 changes: 3 additions & 1 deletion web/src/app/models/loi.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export class LocationOfInterest {
readonly predefined: boolean = true
) {}

static getSmallestByArea(lois: List<LocationOfInterest>): LocationOfInterest {
static getSmallestByArea(
lois: List<LocationOfInterest>
): LocationOfInterest | undefined {
return lois
.sort((a, b) =>
(a.geometry?.getArea() || 0) < (b.geometry?.getArea() || 0) ? -1 : 1
Expand Down
6 changes: 3 additions & 3 deletions web/src/app/services/survey/survey.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ describe('SurveyService', () => {
'title',
'desc',
Map(),
Map({ [mockUser.email]: Role.SURVEY_ORGANIZER }),
Map([[mockUser.email, Role.SURVEY_ORGANIZER]]),
'ownerId',
{ type: DataSharingType.PRIVATE }
);
Expand All @@ -234,7 +234,7 @@ describe('SurveyService', () => {
'title',
'desc',
Map(),
Map({ [mockUser.email]: Role.OWNER }),
Map([[mockUser.email, Role.OWNER]]),
'ownerId',
{ type: DataSharingType.PRIVATE }
);
Expand All @@ -247,7 +247,7 @@ describe('SurveyService', () => {
'title',
'desc',
Map(),
Map({ [mockUser.email]: Role.VIEWER }),
Map([[mockUser.email, Role.VIEWER]]),
'ownerId',
{ type: DataSharingType.PRIVATE }
);
Expand Down
Loading