<commit_before>import { FilterConfigTypes } from "app/Components/ArtworkFilter"
import {
  FilterArray,
  FilterData,
  FilterDisplayName,
  FilterParamName,
} from "app/Components/ArtworkFilter/ArtworkFilterHelpers"
import { ArtworksFiltersStore } from "app/Components/ArtworkFilter/ArtworkFilterStore"
import { FilterDisplayConfig } from "app/Components/ArtworkFilter/types"
import { normalizeText } from "app/utils/normalizeText"
import { compact, filter, orderBy, uniqBy } from "lodash"
import { DateTime } from "luxon"
import { useEffect } from "react"
import { MyCollectionArtworkEdge } from "../MyCollection"

export const useLocalArtworkFilter = (artworksList?: any[] | null) => {
  const setFilterType = ArtworksFiltersStore.useStoreActions((s) => s.setFilterTypeAction)
  const setSortOptions = ArtworksFiltersStore.useStoreActions((s) => s.setSortOptions)
  const setFilterOptions = ArtworksFiltersStore.useStoreActions((s) => s.setFilterOptions)

  const initLocalArtworkFilter = (artworks: any[]) => {
    setFilterType("local")
    setSortOptions([
      {
        paramName: FilterParamName.sort,
        displayText: "Price Paid (High to Low)",
        paramValue: "local-price-paid-high-low",
        // tslint:disable-next-line: no-shadowed-variable
        localSortAndFilter: (artworks) =>
          orderBy(
            artworks,
            (a) => {
              return a.pricePaid?.minor
            },
            "desc"
          ),
      },
      {
        paramName: FilterParamName.sort,
        displayText: "Price Paid (Low to High)",
        paramValue: "local-price-paid-low-high",
        // tslint:disable-next-line: no-shadowed-variable
        localSortAndFilter: (artworks) =>
          orderBy(
            artworks,
            (a) => {
              return a.pricePaid?.minor
            },
            "asc"
          ),
      },
      {
        paramName: FilterParamName.sort,
        displayText: "Artwork Year (Ascending)",
        paramValue: "local-year-old-new",
        // tslint:disable-next-line: no-shadowed-variable
        localSortAndFilter: (artworks) =>
          orderBy(<commit_msg>Fix(cx-2547): sorting MyCollection Artworks for artworks without price paid. (#6680)<commit_after>import { FilterConfigTypes } from "app/Components/ArtworkFilter"
import {
  FilterArray,
  FilterData,
  FilterDisplayName,
  FilterParamName,
} from "app/Components/ArtworkFilter/ArtworkFilterHelpers"
import { ArtworksFiltersStore } from "app/Components/ArtworkFilter/ArtworkFilterStore"
import { FilterDisplayConfig } from "app/Components/ArtworkFilter/types"
import { normalizeText } from "app/utils/normalizeText"
import { compact, filter, orderBy, uniqBy } from "lodash"
import { DateTime } from "luxon"
import { useEffect } from "react"
import { MyCollectionArtworkEdge } from "../MyCollection"

export const useLocalArtworkFilter = (artworksList?: any[] | null) => {
  const setFilterType = ArtworksFiltersStore.useStoreActions((s) => s.setFilterTypeAction)
  const setSortOptions = ArtworksFiltersStore.useStoreActions((s) => s.setSortOptions)
  const setFilterOptions = ArtworksFiltersStore.useStoreActions((s) => s.setFilterOptions)

  const initLocalArtworkFilter = (artworks: any[]) => {
    setFilterType("local")
    setSortOptions([
      {
        paramName: FilterParamName.sort,
        displayText: "Price Paid (High to Low)",
        paramValue: "local-price-paid-high-low",
        // tslint:disable-next-line: no-shadowed-variable
        localSortAndFilter: (artworks) =>
          orderBy(
            artworks,
            (a) => {
              return a.pricePaid?.minor ?? 0
            },
            "desc"
          ),
      },
      {
        paramName: FilterParamName.sort,
        displayText: "Price Paid (Low to High)",
        paramValue: "local-price-paid-low-high",
        // tslint:disable-next-line: no-shadowed-variable
        localSortAndFilter: (artworks) =>
          orderBy(
            artworks,
            (a) => {
              return a.pricePaid?.minor ?? 0
            },
            "asc"
          ),
      },
      {
        paramName: FilterParamName.sort,
        displayText: "Artwork Year (Ascending)",
        paramValue: "local-year-old-new",
        // tslint:disable-next-line: no-shadowed-variable
        localSortAndFilter: (artworks) =>
          orderBy(
{'fraction_non_alphanumeric': 0.1145475372279496, 'fraction_numerical': 0.002290950744558992, 'mean_word_length': 2.738013698630137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6023903', 'n_tokens_mistral': 1279, 'n_tokens_neox': 1264, 'n_words': 248}