Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop invocation reasons #1412

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ bearing with us as we move towards our first stable Lightning release.)
[#1348](https://github.com/OpenFn/Lightning/issues/1348)
- Modify CompleteRun to return error changeset when run not found
[#1393](https://github.com/OpenFn/Lightning/issues/1393)
- Drop invocation reasons from DB
[#1412](https://github.com/OpenFn/Lightning/issues/1412)
- Fix inconsistency in ordering of child nodes in the workflow diagram
[#1406](https://github.com/OpenFn/Lightning/issues/1406)

Expand Down
10 changes: 5 additions & 5 deletions lib/lightning/accounts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ defmodule Lightning.Accounts do

def has_activity_in_projects?(%User{id: id} = _user) do
count =
from(invocation_reason in Lightning.InvocationReason,
where: invocation_reason.user_id == ^id,
select: count(invocation_reason.id)
from(attempt in Lightning.Attempt,
where: attempt.created_by_id == ^id,
select: count(attempt.id)
)
|> Repo.one()

Expand Down Expand Up @@ -67,9 +67,9 @@ defmodule Lightning.Accounts do
@impl Oban.Worker
def perform(%Oban.Job{args: %{"type" => "purge_deleted"}}) do
users_with_activities =
from(invocation_reason in Lightning.InvocationReason,
from(attempt in Lightning.Attempt,
join: user in Lightning.Accounts.User,
on: invocation_reason.user_id == user.id,
on: attempt.created_by_id == user.id,
select: user.id,
distinct: true
)
Expand Down
Loading