Created
February 24, 2020 18:21
-
-
Save Ayoush/ec179bdef1b207b42c9bb62791002cdf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enum.reduce(params, dynamic(true), fn | |
{"workspace_id", workspace_id}, dynamic_query -> | |
dynamic( | |
[task, project, user_task, time_track], | |
^dynamic_query and project.workspace_id == ^workspace_id | |
) | |
{"user_ids", user_ids}, dynamic_query -> | |
user_ids = Enum.map(String.split(user_ids, ","), fn x -> String.to_integer(x) end) | |
dynamic( | |
[task, project, user_task, time_track], | |
^dynamic_query and user_task.user_id in ^user_ids | |
) | |
{"project_ids", project_ids}, dynamic_query -> | |
project_ids = Enum.map(String.split(project_ids, ","), fn x -> String.to_integer(x) end) | |
dynamic( | |
[task, project, user_task, time_track], | |
^dynamic_query and task.project_id in ^project_ids | |
) | |
{_, _}, dynamic_query -> | |
dynamic_query | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment