Przeglądaj źródła

fix: Sorting of Pagelinks in Query tables

sallto 3 lat temu
rodzic
commit
2883bae097

+ 1 - 1
src/main/frontend/format/block.cljs

@@ -59,7 +59,7 @@ and handles unexpected failure."
   "Normalizes supported formats such as dates and percentages."
   "Normalizes supported formats such as dates and percentages."
   ([block]
   ([block]
    (->> [normalize-as-percentage normalize-as-date identity]
    (->> [normalize-as-percentage normalize-as-date identity]
-        (map #(% block))
+        (map #(% (if (set? block) (first block) block)))
         (remove nil?)
         (remove nil?)
         (first))))
         (first))))
 
 

+ 10 - 1
src/test/frontend/format/block_test.cljs

@@ -9,6 +9,12 @@
          "2022-08-12T00:00:00Z"
          "2022-08-12T00:00:00Z"
 
 
          "2022-08-12T00:00:00Z"
          "2022-08-12T00:00:00Z"
+         "2022-08-12T00:00:00Z"
+
+         #{"Aug 12th, 2022"}
+         "2022-08-12T00:00:00Z"
+
+         #{"2022-08-12T00:00:00Z"}
          "2022-08-12T00:00:00Z")))
          "2022-08-12T00:00:00Z")))
 
 
 (deftest test-normalize-percentage
 (deftest test-normalize-percentage
@@ -21,7 +27,10 @@
          0
          0
 
 
          "-5%"
          "-5%"
-         -0.05)))
+         -0.05
+
+         #{"50%"}
+         0.5)))
 
 
 (deftest test-random-values
 (deftest test-random-values
   (testing "random values should not be processed"
   (testing "random values should not be processed"