Commit 2503f4be authored by Markus Shepherd's avatar Markus Shepherd

added similarity model to BGA view

parent 7cd6aee7
......@@ -18,7 +18,8 @@ ludojApp.controller('BgaController', function BgaController(
gamesService,
toastr
) {
var users = {};
var users = {},
routeParams = filterService.getParams($routeParams);
function fetchGames(page) {
toastr.clear();
......@@ -27,12 +28,16 @@ ludojApp.controller('BgaController', function BgaController(
var append = page > 1,
url = API_URL + 'games/recommend_bga/',
userName = $routeParams.for || null,
userName = routeParams.for || null,
params = {'page': page},
promise,
bgaParams,
games;
if (routeParams.similarity) {
params.model = 'similarity';
}
if (!userName) {
promise = $q.resolve(params);
} else if (users[userName]) {
......@@ -130,16 +135,19 @@ ludojApp.controller('BgaController', function BgaController(
});
}
$scope.user = $routeParams.for;
$scope.similarity = $routeParams.similarity;
$scope.user = routeParams.for;
$scope.similarity = routeParams.similarity;
$scope.fetchGames = fetchGames;
$scope.empty = false;
$scope.total = null;
$scope.hideScore = $routeParams.for && $routeParams.similarity;
$scope.hideScore = true;
$scope.updateParams = function updateParams() {
$route.updateParams({'for': $scope.user || null});
$route.updateParams({
'for': $scope.user || null,
'similarity': $scope.similarity || null
});
};
$scope.clearField = function clearField(field, id) {
......@@ -150,7 +158,7 @@ ludojApp.controller('BgaController', function BgaController(
fetchGames(1);
gamesService.setTitle();
gamesService.setTitle(routeParams.for ? 'BGA recommendations for ' + routeParams.for : 'BGA recommendations');
gamesService.setCanonicalUrl($location.path(), filterService.getParams($routeParams));
gamesService.setImage();
gamesService.setDescription();
......
......@@ -38,6 +38,37 @@
</button>
</div>
</div>
<div class="{{ user ? 'form-exclude-enabled' : 'form-exclude-disabled text-muted' }}">
Use recommender model:
<div class="form-check form-check-inline mr-0"
data-toggle="tooltip"
data-placement="bottom"
title="Use the default or similarity based model for recommendations">
<label class="form-check-label form-label-exclude {{ user &amp;&amp; !similarity ? 'text-success' : 'text-muted' }} mr-1"
for="recommender-similarity">
default
</label>
<label class="switch mb-0">
<input type="checkbox"
id="recommender-similarity"
name="recommender-similarity"
ng-model="similarity"
ng-disabled="!user" />
<span class="slider bg-secondary"></span>
</label>
<label class="form-check-label form-label-exclude {{ user &amp;&amp; similarity ? 'text-success' : 'text-muted' }} ml-1"
for="recommender-similarity">
similarity
</label>
</div>
<a href="/#/faq#what-are-the-standard-and-similarity-models-in-the-recommendation-settings"
data-toggle="tooltip"
data-placement="right"
title="Read more about the different models"
class="text-muted">
<i class="fas fa-info-circle"></i>
</a>
</div>
</form>
<h2 ng-if="currUser">
......
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