Skip to content

Commit d5dc2d9

Browse files
committed
Fixed all review feedbacks
1 parent 971d353 commit d5dc2d9

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

app/directives/distribution-graph/distribution-graph.directive.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,6 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
216216
$scope.highlightedRating = d.start
217217
$scope.displayCoders = true
218218
$scope.numCoders = d.number
219-
$scope.$digest()
220-
221219
d3.select('#chart-tooltip')
222220
.style('left', (d3.event.pageX-4) + 'px')
223221
.style('top', (d3.event.pageY-4) + 'px')
@@ -235,6 +233,7 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
235233
d3.select('#chart-tooltip .challenge-date').text('Rating Range: '+ $scope.highlightedRating + '-'+($scope.highlightedRating+99))
236234
d3.select('#chart-tooltip .tooltip-rating').text($scope.numCoders)
237235
d3.select('#chart-tooltip .tooltip-rating').style('background', ratingToColor($scope.colors, $scope.highlightedRating))
236+
$scope.$digest()
238237
})
239238
.on('mousemove', function(d) {
240239
window.clearTimeout(mousemoveInterval)

app/directives/history-graph/history-graph.directive.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
1919
rating: '=',
2020
graphState: '='
2121
},
22-
controller: ['$scope', '$state', '$window', 'CONSTANTS', HistoryGraphController]
22+
controller: ['$scope', '$state', 'CONSTANTS', HistoryGraphController]
2323
}
2424
}
2525

26-
function HistoryGraphController($scope, $state, $window, CONSTANTS) {
26+
function HistoryGraphController($scope, $state, CONSTANTS) {
2727
$scope.colors = [
2828
// grey
2929
{
@@ -275,14 +275,13 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
275275
$scope.historyRating = d.newRating
276276
$scope.historyDate = moment(d.ratingDate).format('YYYY-MM-DD')
277277
$scope.historyChallenge = d.challengeName
278-
$scope.$digest()
279278
$('#chart-tooltip .tooltip-container').on('click', function(){
280-
if($state.params && $state.params.track === 'DEVELOP')
281-
$window.open(CONSTANTS.CHALLENGE_DETAIL_URL + d.challengeId + '/?type=develop', '_blank')
279+
if($state.params && $state.params.track === 'DEVELOP', '_self')
280+
location.href = (CONSTANTS.CHALLENGE_DETAIL_URL + d.challengeId + '/?type=develop')
282281
else if($state.params && $state.params.subTrack === 'SRM')
283-
$window.open(CONSTANTS.SRM_DETAIL_URL + d.challengeId, '_blank')
282+
location.href = (CONSTANTS.SRM_DETAIL_URL + d.challengeId, '_self')
284283
else if($state.params && $state.params.subTrack === 'MARATHON_MATCH')
285-
$window.open(CONSTANTS.MARATHON_DETAIL_URL + d.challengeId, '_blank')
284+
location.href = (CONSTANTS.MARATHON_DETAIL_URL + d.challengeId, '_self')
286285
})
287286
d3.select('#chart-tooltip')
288287
.style('left', (d3.event.pageX-5) + 'px')
@@ -298,21 +297,20 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
298297
d3.select('#chart-tooltip .challenge-date').text(moment(d.ratingDate).format('MMM DD, YYYY'))
299298
d3.select('#chart-tooltip .tooltip-rating').text($scope.historyRating)
300299
d3.select('#chart-tooltip .tooltip-rating').style('background', ratingToColor($scope.colors, $scope.historyRating))
301-
300+
$scope.$digest()
302301
})
303302
.on('mouseout', function(d) {
304303
$scope.historyRating = undefined
305-
$scope.$digest()
306304
$('#chart-tooltip').off('click')
305+
$scope.$digest()
307306
})
308307

309308
d3.select('body').on('click', function(){
310309
if((d3.event.target.classList[0] != 'tooltip-target') && !$('#chart-tooltip .tooltip-container').hasClass('tooltip-hide') &&
311310
(d3.event.target.classList[0] != 'tooltip-content-container') && (d3.event.target.classList[0] != 'tooltip-container') &&
312311
(d3.event.target.classList[0] != 'tooltip-body') && (d3.event.target.classList[0] != 'Tooltip') &&
313312
(d3.event.target.tagName.toLowerCase()!='circle') && !(d3.event.target.tagName.toLowerCase()=='rect' && d3.event.target.classList[0] == 'hover')) {
314-
$('#chart-tooltip .tooltip-container').addClass('tooltip-hide')
315-
$('#chart-tooltip .tooltip-container').css('opacity', 0)
313+
$('#chart-tooltip .tooltip-target').trigger('click')
316314
}
317315
})
318316

0 commit comments

Comments
 (0)