Commit 0f058895 authored by Volker Krause's avatar Volker Krause
Browse files

Only add static attributions if a backend actually contributed results

Previously this was a bit too aggressive and we ended up with static
attributions also for backends not even supporting departure or journey
queries.
parent bf25bc78
......@@ -250,6 +250,9 @@ void JourneyReply::addResult(const AbstractBackend *backend, std::vector<Journey
Cache::addNegativeDepartureCacheEntry(backend->backendId(), request().cacheKey());
}
// apply static attributions if @p backend contributed to the results
addAttribution(backend->attribution());
// update result
if (!res.empty()) {
if (d->journeys.empty()) {
......
......@@ -321,8 +321,6 @@ static Location::Types locationTypesForJourneyRequest(const JourneyRequest &req)
bool ManagerPrivate::queryJourney(const AbstractBackend* backend, const JourneyRequest &req, JourneyReply *reply)
{
reply->addAttribution(backend->attribution());
auto cache = Cache::lookupJourney(backend->backendId(), req.cacheKey());
switch (cache.type) {
case CacheHitType::Negative:
......@@ -389,8 +387,6 @@ bool ManagerPrivate::queryJourney(const AbstractBackend* backend, const JourneyR
bool ManagerPrivate::queryStopover(const AbstractBackend *backend, const StopoverRequest &req, StopoverReply *reply)
{
reply->addAttribution(backend->attribution());
auto cache = Cache::lookupDeparture(backend->backendId(), req.cacheKey());
switch (cache.type) {
case CacheHitType::Negative:
......
......@@ -124,6 +124,9 @@ void StopoverReply::addResult(const AbstractBackend *backend, std::vector<Stopov
StopoverUtil::applyMetaData(dep, request().downloadAssets());
}
// apply static attributions if @p backend contributed to the results
addAttribution(backend->attribution());
// cache negative hits, positive ones are too short-lived
if (res.empty()) {
Cache::addNegativeDepartureCacheEntry(backend->backendId(), request().cacheKey());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment