Project

General

Profile

« Previous | Next » 

Revision 55902

[angular7|library]

Merging Trunk into branch 55729:55901

View differences:

searchPublications.service.ts
40 40
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
41 41
                    //.map(res => <any> res.json())
42 42
                    // .do(res => console.info(res))
43
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]));
43
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]));
44 44
    }
45 45
    searchPublicationById (id: string, properties:EnvProperties ):any {
46 46

  
......
48 48

  
49 49
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
50 50
                    //.map(res => <any> res.json())
51
                    .pipe(map(res =>  this.parseResults(res)));
51
                    .pipe(map(res =>  this.parseResults(res, properties)));
52 52
    }
53 53

  
54 54
    searchAggregators (id: string, params: string, refineParams:string, page: number, size: number, properties:EnvProperties ):any {
......
93 93
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
94 94
                    //.map(res => <any> res.json())
95 95
                    //.do(res => console.info(res))
96
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]));
96
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]));
97

  
97 98
    }
98 99

  
99 100
    advancedSearchPublications (params: string, page: number, size: number, sortBy: string, properties:EnvProperties ):any {
......
118 119
      //.map(res => <any> res.json())
119 120
      //.do(res => console.info(res))
120 121

  
121
      .pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
122
      .pipe(map(res => [res['meta'].total, this.parseResults(res['results'], properties)]));
123

  
122 124
    }
123 125
    searchPublicationsForEntity (params: string, page: number, size: number, properties:EnvProperties):any {
124 126
        let link = properties.searchAPIURLLAst;
......
129 131

  
130 132
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
131 133
                    //.map(res => <any> res.json())
132
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
134
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'], properties)]));
133 135
    }
134 136

  
135 137
    searchPublicationsForDataproviders(params: string, page: number, size: number, properties:EnvProperties):any {
......
137 139
        let url = link+params+ "&page="+(page-1)+"&size="+size + "&format=json";
138 140
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
139 141
                    //.map(res => <any> res.json())
140
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
142
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'], properties)]));
141 143
    }
142 144
/*
143 145
	searchPublicationsCSV (params: string, refineParams:string, page: number, size: number):any {
......
163 165
    }
164 166
*/
165 167

  
166
    parseResults(data: any): SearchResult[] {
168
    parseResults(data: any, properties: EnvProperties): SearchResult[] {
167 169
        let results: SearchResult[] = [];
168 170

  
169 171
        let length = Array.isArray(data) ? data.length : 1;
......
258 260

  
259 261
            if(resData.hasOwnProperty("creator") && resData['creator'] != null) {
260 262
              if(result['authors'] == undefined) {
261
                result['authors'] = new Array<string>();
263
                result['authors'] = new Array<{"fullName": string, "orcid": string}>();
262 264
              }
263 265

  
264 266
              let authors = resData['creator'];
......
266 268

  
267 269
              for(let i=0; i<length; i++) {
268 270
                let author = Array.isArray(authors) ? authors[i] : authors;
269
                result.authors[author.rank] = author.content;
271
                if(author) {
272
                  /*if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) {
273
                    author.ORCID = author.ORCID.substr(properties.orcidURL.length);
274
                  }*/
275
                  result['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID};
276
                }
270 277
              }
271 278
              result.authors = result.authors.filter(function (item) {
272
                return (item != undefined);
279
                return (item != undefined && item.fullName != undefined);
273 280
              });
274 281
            }
275 282

  

Also available in: Unified diff