1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix weird ternary statements that sonar flags

This commit is contained in:
Bill Thornton 2022-10-04 16:16:54 -04:00
parent 9cb03ba4e5
commit 3417d56bf3
2 changed files with 4 additions and 2 deletions

View file

@ -390,7 +390,8 @@ import { appRouter } from '../appRouter';
} else if (options.indexBy === 'ProductionYear') {
newIndexValue = item.ProductionYear;
} else if (options.indexBy === 'CommunityRating') {
newIndexValue = item.CommunityRating ? (Math.floor(item.CommunityRating) + (item.CommunityRating % 1 >= 0.5 ? 0.5 : 0)) + '+' : null;
const roundedRatingDecimal = item.CommunityRating % 1 >= 0.5 ? 0.5 : 0;
newIndexValue = item.CommunityRating ? (Math.floor(item.CommunityRating) + roundedRatingDecimal) + '+' : null;
}
if (newIndexValue !== currentIndexValue) {

View file

@ -459,7 +459,8 @@ const scrollerFactory = function (frame, options) {
*/
function dragHandler(event) {
dragging.released = event.type === 'mouseup' || event.type === 'touchend';
const pointer = dragging.touch ? event[dragging.released ? 'changedTouches' : 'touches'][0] : event;
const eventName = dragging.released ? 'changedTouches' : 'touches';
const pointer = dragging.touch ? event[eventName][0] : event;
dragging.pathX = pointer.pageX - dragging.initX;
dragging.pathY = pointer.pageY - dragging.initY;
dragging.path = Math.sqrt(Math.pow(dragging.pathX, 2) + Math.pow(dragging.pathY, 2));