Skip to content

Commit

Permalink
Update device user list to use multiple location lists
Browse files Browse the repository at this point in the history
  • Loading branch information
esurface committed Nov 9, 2023
1 parent 37932d0 commit 1eedf26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions editor/src/app/groups/responses/responses.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export class ResponsesComponent implements OnInit {
}

async getResponses() {
const locationList = await this.http.get('./assets/location-list.json').toPromise()
const data: any = await this.groupsService.getLocationLists(this.groupId);
const locationLists = data;
let responses = []
if (this.filterBy === '*') {
responses = <Array<any>>await this.http.get(`/api/${this.groupId}/responses/${this.limit}/${this.skip}`).toPromise()
Expand All @@ -56,7 +57,7 @@ export class ResponsesComponent implements OnInit {
}
const flatResponses = []
for (let response of responses) {
const flatResponse = await generateFlatResponse(response, locationList, false)
const flatResponse = await generateFlatResponse(response, locationLists, false)
this.excludeColumns.forEach(column => delete flatResponse[column])
flatResponses.push(flatResponse)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

export const generateFlatResponse = async function (formResponse, locationList, sanitized) {
export const generateFlatResponse = async function (formResponse, locationLists, sanitized) {
const process = {
env: {
T_REPORTING_MARK_SKIPPED_WITH: 'SKIPPED',
Expand Down Expand Up @@ -58,6 +58,7 @@ export const generateFlatResponse = async function (formResponse, locationList,
for (let group of input.value) {
locationKeys.push(group.value)
try {
const locationList = locationLists.find(l => input.locationSrc.endsWith(l.path))
const location = getLocationByKeys(locationKeys, locationList)
set(input, location.level, location.label)
} catch (e) {
Expand Down

0 comments on commit 1eedf26

Please sign in to comment.