Skip to content

Commit

Permalink
Prettier part 2, formatters fight!
Browse files Browse the repository at this point in the history
  • Loading branch information
FinalDoom authored and FinalDoom committed Feb 20, 2022
1 parent 9be02ba commit 26ba089
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
10 changes: 5 additions & 5 deletions client/src/javascript/stores/TorrentFilterStore.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { computed, makeAutoObservable } from 'mobx';
import jsonpatch, { Operation } from 'fast-json-patch';
import { KeyboardEvent, MouseEvent, TouchEvent } from 'react';
import {computed, makeAutoObservable} from 'mobx';
import jsonpatch, {Operation} from 'fast-json-patch';
import {KeyboardEvent, MouseEvent, TouchEvent} from 'react';

import type { Taxonomy } from '@shared/types/Taxonomy';
import torrentStatusMap, { TorrentStatus } from '@shared/constants/torrentStatusMap';
import type {Taxonomy} from '@shared/types/Taxonomy';
import torrentStatusMap, {TorrentStatus} from '@shared/constants/torrentStatusMap';

class TorrentFilterStore {
locationFilter: Array<string> = [];
Expand Down
48 changes: 24 additions & 24 deletions server/services/taxonomyService.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import jsonpatch, { Operation } from 'fast-json-patch';
import jsonpatch, {Operation} from 'fast-json-patch';

import BaseService from './BaseService';
import torrentStatusMap from '../../shared/constants/torrentStatusMap';

import type { Taxonomy, LocationTreeNode } from '../../shared/types/Taxonomy';
import type { TorrentStatus } from '../../shared/constants/torrentStatusMap';
import type { TorrentProperties, TorrentList } from '../../shared/types/Torrent';
import type {Taxonomy, LocationTreeNode} from '../../shared/types/Taxonomy';
import type {TorrentStatus} from '../../shared/constants/torrentStatusMap';
import type {TorrentProperties, TorrentList} from '../../shared/types/Torrent';

interface TaxonomyServiceEvents {
TAXONOMY_DIFF_CHANGE: (payload: { id: number; diff: Operation[] }) => void;
TAXONOMY_DIFF_CHANGE: (payload: {id: number; diff: Operation[]}) => void;
}

class TaxonomyService extends BaseService<TaxonomyServiceEvents> {
taxonomy: Taxonomy = {
locationCounts: { '': 0 },
locationCounts: {'': 0},
locationSizes: {},
locationTree: [],
statusCounts: { '': 0 },
tagCounts: { '': 0, untagged: 0 },
statusCounts: {'': 0},
tagCounts: {'': 0, untagged: 0},
tagSizes: {},
trackerCounts: { '': 0 },
trackerCounts: {'': 0},
trackerSizes: {},
};

Expand All @@ -33,7 +33,7 @@ class TaxonomyService extends BaseService<TaxonomyServiceEvents> {
return;
}

const { clientGatewayService } = this.services;
const {clientGatewayService} = this.services;

clientGatewayService.on('PROCESS_TORRENT_LIST_START', this.handleProcessTorrentListStart);
clientGatewayService.on('PROCESS_TORRENT_LIST_END', this.handleProcessTorrentListEnd);
Expand All @@ -46,7 +46,7 @@ class TaxonomyService extends BaseService<TaxonomyServiceEvents> {
return;
}

const { clientGatewayService } = this.services;
const {clientGatewayService} = this.services;

clientGatewayService.removeListener('PROCESS_TORRENT_LIST_START', this.handleProcessTorrentListStart);
clientGatewayService.removeListener('PROCESS_TORRENT_LIST_END', this.handleProcessTorrentListEnd);
Expand All @@ -64,27 +64,27 @@ class TaxonomyService extends BaseService<TaxonomyServiceEvents> {

handleProcessTorrentListStart = () => {
this.lastTaxonomy = {
locationCounts: { ...this.taxonomy.locationCounts },
locationSizes: { ...this.taxonomy.locationCounts },
locationCounts: {...this.taxonomy.locationCounts},
locationSizes: {...this.taxonomy.locationCounts},
locationTree: [...this.taxonomy.locationTree],
statusCounts: { ...this.taxonomy.statusCounts },
tagCounts: { ...this.taxonomy.tagCounts },
tagSizes: { ...this.taxonomy.tagSizes },
trackerCounts: { ...this.taxonomy.trackerCounts },
trackerSizes: { ...this.taxonomy.trackerSizes },
statusCounts: {...this.taxonomy.statusCounts},
tagCounts: {...this.taxonomy.tagCounts},
tagSizes: {...this.taxonomy.tagSizes},
trackerCounts: {...this.taxonomy.trackerCounts},
trackerSizes: {...this.taxonomy.trackerSizes},
};

torrentStatusMap.forEach((status) => {
this.taxonomy.statusCounts[status] = 0;
});

this.taxonomy.locationCounts = { '': 0 };
this.taxonomy.locationCounts = {'': 0};
this.taxonomy.locationSizes = {};
this.taxonomy.locationTree = [];
this.taxonomy.statusCounts[''] = 0;
this.taxonomy.tagCounts = { '': 0, untagged: 0 };
this.taxonomy.tagCounts = {'': 0, untagged: 0};
this.taxonomy.tagSizes = {};
this.taxonomy.trackerCounts = { '': 0 };
this.taxonomy.trackerCounts = {'': 0};
this.taxonomy.trackerSizes = {};
};

Expand All @@ -107,7 +107,7 @@ class TaxonomyService extends BaseService<TaxonomyServiceEvents> {
this.taxonomy.locationTree = sortedLocations.reduce((tree, filter) => {
const directory = filter.split(separator).slice(-1)[0];
const parentPath = filter.substring(0, filter.lastIndexOf(separator + directory));
const location: LocationTreeNode = { directoryName: directory, fullPath: filter, children: [] };
const location: LocationTreeNode = {directoryName: directory, fullPath: filter, children: []};
while (previousLocation) {

Check warning on line 111 in server/services/taxonomyService.ts

View check run for this annotation

Codecov / codecov/patch

server/services/taxonomyService.ts#L111

Added line #L111 was not covered by tests
// Move up the tree to a matching parent
if (!previousLocation.parent || previousLocation.fullPath === parentPath) {
Expand Down Expand Up @@ -137,8 +137,8 @@ class TaxonomyService extends BaseService<TaxonomyServiceEvents> {
location.children.forEach(this.cleanLocationTree);
};

handleProcessTorrentListEnd = ({ torrents }: { torrents: TorrentList }) => {
const { length } = Object.keys(torrents);
handleProcessTorrentListEnd = ({torrents}: {torrents: TorrentList}) => {
const {length} = Object.keys(torrents);

this.buildLocationTree();
this.taxonomy.locationTree.forEach(this.cleanLocationTree);
Expand Down

0 comments on commit 26ba089

Please sign in to comment.