Skip to content

Commit

Permalink
Allow offline usage for POIs #1169 - Small issues + logging images to…
Browse files Browse the repository at this point in the history
… show.
  • Loading branch information
HarelM committed Jun 7, 2020
1 parent cb810cc commit a2ebcc2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion IsraelHiking.API/Executors/FeaturesMergeExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private List<Feature> MergeExternalFeaturesToOsm(List<Feature> osmFeatures, List
}
}
externalFeatures = externalFeatures.Where(f => featureIdsToRemove.Contains(f.GetId()) == false).ToList();
_logger.LogInformation("Finisehd external features merging by title into OSM. " + externalFeatures.Count);
_logger.LogInformation("Finished external features merging by title into OSM. " + externalFeatures.Count);
return externalFeatures;
}

Expand Down
6 changes: 1 addition & 5 deletions IsraelHiking.API/Services/Osm/DatabasesUpdaterService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,7 @@ private async Task RebuildPointsOfInterest()
var osmSource = _pointsOfInterestAdapterFactory.GetBySource(Sources.OSM);
var osmFeaturesTask = osmSource.GetPointsForIndexing();
var sources = _pointsOfInterestAdapterFactory.GetAll().Where(s => s.Source != Sources.OSM).Select(s => s.Source);
var externalFeatures = new List<Feature>();
foreach (var source in sources)
{
externalFeatures.AddRange(await _elasticSearchGateway.GetExternalPoisBySource(source));
}
var externalFeatures = sources.Select(s => _elasticSearchGateway.GetExternalPoisBySource(s)).SelectMany(t => t.Result).ToList();
if (externalFeatures.GroupBy(f => f.GetId()).Any(g => g.Count() > 1))
{
_logger.LogWarning("Got duplicate id from database :-(");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ import { encode } from "base64-arraybuffer";

import { RunningContextService } from "../services/running-context.service";
import { DatabaseService } from "../services/database.service";
import { LoggingService } from "../services/logging.service";

@Pipe({ name: "offlineImage" })
export class OfflineImagePipe implements PipeTransform {
constructor(private readonly http: HttpClient,
private readonly runningContextService: RunningContextService,
private readonly loggingService: LoggingService,
private readonly databaseService: DatabaseService) {
}

public async transform(value: string, cache: boolean): Promise<string> {
// HM TODO: remove this when issue is resolved!
this.loggingService.debug("Showing image: " + value + ", isOnline: " + this.runningContextService.isOnline + ", cache: " + cache);
if (!this.runningContextService.isOnline) {
let data = await this.databaseService.getImageByUrl(value);
if (data != null) {
Expand Down

0 comments on commit a2ebcc2

Please sign in to comment.