Skip to content

Commit

Permalink
Fix issues in last PR (#43)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew <akmolina28@users.noreply.github.com>

* selecting a profile should de-select the others

* round off confidence percentages
  • Loading branch information
akmolina28 committed Feb 9, 2021
1 parent 01a5c78 commit 615be15
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
4 changes: 4 additions & 0 deletions src/resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Vue.filter('dateStr', function(value) {
return moment.utc(value).local();
});

Vue.filter('percentage', function (value) {
return Math.round(value * 100) + "%";
});

Vue.filter('dateStrRelative', function(value) {
return moment.utc(value).local().fromNow();
});
Expand Down
21 changes: 11 additions & 10 deletions src/resources/js/components/ShowDetectionEvent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,6 @@
}
},
filters: {
percentage(value) {
return (value * 100) + "%";
}
},
methods: {
soloHighlightPrediction(prediction) {
if (this.soloPrediction && this.soloPrediction.id === prediction.id) {
Expand Down Expand Up @@ -369,13 +363,16 @@
this.highlightMask = null;
},
highlightAllPredictions() {
this.soloPrediction = null;
this.highlightMask = null;
clearSelectedProfile() {
this.event.pattern_matched_profiles.forEach(p => {
if (p.isSelected) this.toggleSelectedProfile(p);
});
},
highlightAllPredictions() {
this.soloPrediction = null;
this.highlightMask = null;
this.clearSelectedProfile();
let predictions = [];
Expand All @@ -400,6 +397,10 @@
this.soloPrediction = null;
profile.isSelected = !profile.isSelected;
this.event.pattern_matched_profiles.forEach(p => {
if (p.id !== profile.id) p.isSelected = false;
});
if (profile.isSelected) {
this.highlightPredictions = this.sortPredictions(this.getPredictionsForProfile(profile));
this.highlightMask = profile.use_mask ? profile.slug + '.png' : null;
Expand Down

0 comments on commit 615be15

Please sign in to comment.