         group
 
       %{point_ids: unsorted, sort_type: sort_by} = point_group ->
-        sorted =
-          Repo.all(from(p in Point, where: p.id in ^unsorted))
+        sorted_and_augmented = CriteriaRetriever.run(point_group)
           |> sort_points(sort_by)
           |> Enum.map(&Map.fetch!(&1, :id))
 
-        %{point_group | point_ids: sorted}
+        %{point_group | point_ids: sorted_and_augmented}
     end
   end
 

    PublicKey,
    Regimen,
    RegimenInstance,
    Sequence,
    Sensor,
    SensorReading,
    Tool
  }


  """

  alias FarmbotCore.Asset.{
    CriteriaRetriever,
    Device,
    DeviceCert,
    FarmEvent,
    FarmwareEnv,
    FarmwareInstallation,
    FbosConfig,
    FirmwareConfig,
    FirstPartyFarmware,
    Peripheral,
    PinBinding,
    Point,
