Skip to content

Commit f51ae76

Browse files
committed
app: removed all references to user_location table
The user_location table became useless since we're calculating personalized ratings off the new ratings_cache field on the location table instead. The ratings_cache was added in pull request #488 and user_location table became quite pointless after that.
1 parent 4e9d5f4 commit f51ae76

4 files changed

Lines changed: 0 additions & 25 deletions

File tree

app/app/AnswerRepository.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,6 @@ public static function commitAnswersForLocation(string $location_id)
262262
$location->universal_rating = null;
263263
$location->ratings_cache = null;
264264
$location->save();
265-
// invalidate the personalized rating cache for this location.
266-
DB::table('user_location')->where('location_id', '=', $location_id)->delete();
267265
}
268266
AnswerRepository::destroyUncommittedChanges();
269267
}

app/app/Http/Controllers/ProfileController.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,6 @@ public function save(Request $request)
130130
$questions_updated = true;
131131
}
132132
}
133-
if ($questions_updated) {
134-
/*
135-
If the accessibility needs changed,
136-
the personalized ratings need to be recalculated.
137-
*/
138-
$user->personalizedRatings()->detach();
139-
}
140133

141134
$user->save();
142135

app/app/Location.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ public function tags()
5252
return $this->belongsToMany('App\LocationTag');
5353
}
5454

55-
public function personalizedRatings()
56-
{
57-
return $this->hasMany('App\UserLocation');
58-
}
59-
6055
public function comments()
6156
{
6257
return $this->hasMany(ReviewComment::class);

app/app/User.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,7 @@ public function requiredQuestions()
8181
{
8282
return $this->belongsToMany(Question::class, 'user_question');
8383
}
84-
85-
/**
86-
personalizedRatings reteurns an Eloquent query object that
87-
can be used to get the personalized ratings for various locations.
8884

89-
This is used as a cache for speeding up display of many locations while signed in.
90-
*/
91-
public function personalizedRatings()
92-
{
93-
return $this->belongsToMany(Location::class, 'user_location');
94-
}
95-
9685
public static function generateSaltedHash($password)
9786
{
9887
return Hash::make($password);

0 commit comments

Comments
 (0)