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

Tobi mega issue #351

Open
3 of 20 tasks
PragTob opened this issue Sep 15, 2024 · 6 comments
Open
3 of 20 tasks

Tobi mega issue #351

PragTob opened this issue Sep 15, 2024 · 6 comments

Comments

@PragTob
Copy link
Collaborator

PragTob commented Sep 15, 2024

Aight here is an overview issue, high level I haven't looked at the code in more detail yet:

Overview

image

Phoenix HTML style/dependency upgrade

(gave this one its own section due to its importance imo)

This relates to #310 but is more than this. The HTML usage is kind of old. There is a new "style" with heex to write components in that we don't seem to be using that seems to have been [introduced in 0.16[(https://hexdocs.pm/phoenix_live_view/bindings.html#rate-limiting-events-with-debounce-and-throttle) (we're on 0.18.18):

i.e. instead of:

<%= f = form_for @changeset, "#" %>
  <%= input f, :foo %>
</form>

what's done is:

<.form :let={f} for={@changeset}>
  <%= input f, :foo %>
</.form>

(and I think these days you also use a function component for input so <.input ... >).

Most notably phoenix now generates some core components (see f.ex. here - not sure when it was introduced) which is really nice and useful imo. (future Tobi: seems to have been added in 1.7 along with tailwind)

Might be nice to start the migration soon (unless there are deadlines), as otherwise it'll always become more code to change. I think it can be done step by step. Maybe after #344 ?

Performance

  • Check likes more efficiently/without n+1 (right now there is at least one query fired per idea)
  • overall it feels like there are too many db queries on page load, but other than for the likes I'm not too certain
Full page load query logs for me
[info] Sent 200 in 16ms
[info] CONNECTED TO Phoenix.LiveView.Socket in 44µs
  Transport: :websocket
  Serializer: Phoenix.Socket.V2.JSONSerializer
  Parameters: %{"_csrf_token" => "SgtKFFQ5Iwp7DXEaQTRsCCUkVAgRMDswxzx-1AtH8O8o0_9RGSloxURJ", "_live_referer" => "undefined", "_mounts" => "0", "_track_static" => %{"0" => "http://localhost:4000/assets/app.css", "1" => "http://localhost:4000/assets/app.js"}, "vsn" => "2.0.0"}
[debug] MOUNT MindwendelWeb.BrainstormingLive.Show
  Parameters: %{"id" => "83e5c67e-800e-40ca-86be-8fd02a15289e"}
  Session: %{"_csrf_token" => "2q29exWBCBIuqkUZbw8gieiz", "current_user_id" => "cd21937f-d428-4deb-96e5-bf7e7559817b"}
[debug] QUERY OK source="brainstormings" db=0.3ms idle=130.9ms
SELECT b0."id", b0."name", b0."option_show_link_to_settings", b0."option_allow_manual_ordering", b0."admin_url_id", b0."last_accessed_at", b0."creating_user_id", b0."inserted_at", b0."updated_at" FROM "brainstormings" AS b0 WHERE (b0."id" = $1) ["83e5c67e-800e-40ca-86be-8fd02a15289e"]
[debug] QUERY OK source="users" db=0.3ms idle=131.3ms
SELECT u0."id", u0."username", u0."inserted_at", u0."updated_at", b1."brainstorming_id"::uuid FROM "users" AS u0 INNER JOIN "brainstorming_users" AS b1 ON u0."id" = b1."user_id" WHERE (b1."brainstorming_id" = ANY($1)) ORDER BY b1."brainstorming_id"::uuid [["83e5c67e-800e-40ca-86be-8fd02a15289e"]]
[debug] QUERY OK source="ideas" db=0.3ms idle=131.1ms
SELECT i0."id", i0."body", i0."position_order", i0."username", i0."label", i0."user_id", i0."brainstorming_id", i0."label_id", i0."inserted_at", i0."updated_at", i0."brainstorming_id" FROM "ideas" AS i0 WHERE (i0."brainstorming_id" = $1) ORDER BY i0."brainstorming_id" ["83e5c67e-800e-40ca-86be-8fd02a15289e"]
[debug] QUERY OK source="users" db=0.6ms idle=131.1ms
SELECT u0."id", u0."username", u0."inserted_at", u0."updated_at", b1."brainstorming_id"::uuid FROM "users" AS u0 INNER JOIN "brainstorming_moderating_users" AS b1 ON u0."id" = b1."user_id" WHERE (b1."brainstorming_id" = ANY($1)) ORDER BY b1."brainstorming_id"::uuid [["83e5c67e-800e-40ca-86be-8fd02a15289e"]]
[debug] QUERY OK source="idea_labels" db=0.6ms idle=130.9ms
SELECT i0."id", i0."name", i0."color", i0."position_order", i0."brainstorming_id", i0."inserted_at", i0."updated_at", i0."brainstorming_id" FROM "idea_labels" AS i0 WHERE (i0."brainstorming_id" = $1) ORDER BY i0."brainstorming_id", i0."position_order" ["83e5c67e-800e-40ca-86be-8fd02a15289e"]
[debug] QUERY OK source="likes" db=0.3ms idle=131.7ms
SELECT l0."id", l0."idea_id", l0."user_id", l0."inserted_at", l0."updated_at", l0."idea_id" FROM "likes" AS l0 WHERE (l0."idea_id" = ANY($1)) ORDER BY l0."idea_id" [["65c32039-8ae3-4486-b1b0-b90bcf8b4d0f", "d129ae49-fd23-462d-b16c-75d8e5e230e0", "d6200337-8f10-4c15-90ce-b990c7a2335c", "73cff1b7-570c-477d-8a94-1063ba529c78", "d8ca932e-c069-4d42-91a7-719c146c47a5", "7a1e6312-e0e0-45ad-ade7-c5d8298fd28d", "fb7fff0b-a0e6-45f0-bfed-99bb58eb9d03", "967b1d37-fce1-4071-82c2-332e463a431c", "e5f01ac1-6763-40e5-b5e4-c52ed0f3749b", "408c9f14-33ba-4a7b-bf7a-a2ddacfb7ab9", "3028f9a1-1f4a-457e-b548-026500979d4f", "c2d13754-b5b9-467d-bbb4-1f26b9dd6f86", "ad3f93fc-54bd-4e2a-8e2d-f818375cc353", "5edcf1a3-9d73-437f-8b86-b60875757b01", "6af93d2a-879d-4ac4-9078-a8659f84b38f", "ced4588c-b8ee-4c05-b910-134365649301"]]
[debug] QUERY OK source="idea_labels" db=0.4ms idle=131.6ms
SELECT i0."id", i0."name", i0."color", i0."position_order", i0."brainstorming_id", i0."inserted_at", i0."updated_at", i1."idea_id"::uuid FROM "idea_labels" AS i0 INNER JOIN "idea_idea_labels" AS i1 ON i0."id" = i1."idea_label_id" WHERE (i1."idea_id" = ANY($1)) ORDER BY i1."idea_id"::uuid [["65c32039-8ae3-4486-b1b0-b90bcf8b4d0f", "d129ae49-fd23-462d-b16c-75d8e5e230e0", "d6200337-8f10-4c15-90ce-b990c7a2335c", "73cff1b7-570c-477d-8a94-1063ba529c78", "d8ca932e-c069-4d42-91a7-719c146c47a5", "7a1e6312-e0e0-45ad-ade7-c5d8298fd28d", "fb7fff0b-a0e6-45f0-bfed-99bb58eb9d03", "967b1d37-fce1-4071-82c2-332e463a431c", "e5f01ac1-6763-40e5-b5e4-c52ed0f3749b", "408c9f14-33ba-4a7b-bf7a-a2ddacfb7ab9", "3028f9a1-1f4a-457e-b548-026500979d4f", "c2d13754-b5b9-467d-bbb4-1f26b9dd6f86", "ad3f93fc-54bd-4e2a-8e2d-f818375cc353", "5edcf1a3-9d73-437f-8b86-b60875757b01", "6af93d2a-879d-4ac4-9078-a8659f84b38f", "ced4588c-b8ee-4c05-b910-134365649301"]]
[debug] QUERY OK source="links" db=0.5ms idle=131.5ms
SELECT l0."id", l0."url", l0."title", l0."description", l0."img_preview_url", l0."idea_id", l0."inserted_at", l0."updated_at", l0."idea_id" FROM "links" AS l0 WHERE (l0."idea_id" = ANY($1)) [["65c32039-8ae3-4486-b1b0-b90bcf8b4d0f", "d129ae49-fd23-462d-b16c-75d8e5e230e0", "d6200337-8f10-4c15-90ce-b990c7a2335c", "73cff1b7-570c-477d-8a94-1063ba529c78", "d8ca932e-c069-4d42-91a7-719c146c47a5", "7a1e6312-e0e0-45ad-ade7-c5d8298fd28d", "fb7fff0b-a0e6-45f0-bfed-99bb58eb9d03", "967b1d37-fce1-4071-82c2-332e463a431c", "e5f01ac1-6763-40e5-b5e4-c52ed0f3749b", "408c9f14-33ba-4a7b-bf7a-a2ddacfb7ab9", "3028f9a1-1f4a-457e-b548-026500979d4f", "c2d13754-b5b9-467d-bbb4-1f26b9dd6f86", "ad3f93fc-54bd-4e2a-8e2d-f818375cc353", "5edcf1a3-9d73-437f-8b86-b60875757b01", "6af93d2a-879d-4ac4-9078-a8659f84b38f", "ced4588c-b8ee-4c05-b910-134365649301"]]
[debug] QUERY OK source="users" db=0.3ms idle=129.5ms
SELECT u0."id", u0."username", u0."inserted_at", u0."updated_at" FROM "users" AS u0 WHERE (u0."id" = $1) ["cd21937f-d428-4deb-96e5-bf7e7559817b"]
[debug] QUERY OK source="users" db=0.2ms idle=129.5ms
SELECT u0."id", u0."username", u0."inserted_at", u0."updated_at" FROM "users" AS u0 WHERE (u0."id" = $1) ["cd21937f-d428-4deb-96e5-bf7e7559817b"]
[debug] QUERY OK source="brainstormings" db=0.4ms idle=3.7ms
SELECT b0."id", b0."name", b0."option_show_link_to_settings", b0."option_allow_manual_ordering", b0."admin_url_id", b0."last_accessed_at", b0."creating_user_id", b0."inserted_at", b0."updated_at", b1."user_id"::uuid FROM "brainstormings" AS b0 INNER JOIN "brainstorming_users" AS b1 ON b0."id" = b1."brainstorming_id" WHERE (b1."user_id" = ANY($1)) ORDER BY b1."user_id"::uuid [["cd21937f-d428-4deb-96e5-bf7e7559817b"]]
[debug] QUERY OK source="inspirations" db=0.1ms idle=3.7ms
SELECT i0."id", i0."title", i0."type", i0."language", i0."inserted_at", i0."updated_at" FROM "inspirations" AS i0 ORDER BY RANDOM() LIMIT 1 []
[debug] Replied in 5ms
[debug] HANDLE PARAMS in MindwendelWeb.BrainstormingLive.Show
  Parameters: %{"id" => "83e5c67e-800e-40ca-86be-8fd02a15289e"}
[debug] QUERY OK source="ideas" db=0.3ms idle=4.3ms
SELECT i0."id", i0."body", i0."position_order", i0."username", i0."label", i0."user_id", i0."brainstorming_id", i0."label_id", i0."inserted_at", i0."updated_at" FROM "ideas" AS i0 LEFT OUTER JOIN (SELECT sl0."idea_id" AS "idea_id", count(1) AS "like_count" FROM "likes" AS sl0 GROUP BY sl0."idea_id") AS s1 ON s1."idea_id" = i0."id" WHERE (i0."brainstorming_id" = $1) ORDER BY i0."position_order" ASC NULLS LAST, i0."updated_at" DESC ["83e5c67e-800e-40ca-86be-8fd02a15289e"]
[debug] QUERY OK source="likes" db=0.2ms idle=5.0ms
SELECT l0."id", l0."idea_id", l0."user_id", l0."inserted_at", l0."updated_at", l0."idea_id" FROM "likes" AS l0 WHERE (l0."idea_id" = ANY($1)) ORDER BY l0."idea_id" [["5edcf1a3-9d73-437f-8b86-b60875757b01", "6af93d2a-879d-4ac4-9078-a8659f84b38f", "ced4588c-b8ee-4c05-b910-134365649301", "ad3f93fc-54bd-4e2a-8e2d-f818375cc353", "c2d13754-b5b9-467d-bbb4-1f26b9dd6f86", "3028f9a1-1f4a-457e-b548-026500979d4f", "408c9f14-33ba-4a7b-bf7a-a2ddacfb7ab9", "e5f01ac1-6763-40e5-b5e4-c52ed0f3749b", "967b1d37-fce1-4071-82c2-332e463a431c", "d8ca932e-c069-4d42-91a7-719c146c47a5", "fb7fff0b-a0e6-45f0-bfed-99bb58eb9d03", "73cff1b7-570c-477d-8a94-1063ba529c78", "d6200337-8f10-4c15-90ce-b990c7a2335c", "d129ae49-fd23-462d-b16c-75d8e5e230e0", "7a1e6312-e0e0-45ad-ade7-c5d8298fd28d", "65c32039-8ae3-4486-b1b0-b90bcf8b4d0f"]]
[debug] QUERY OK source="links" db=0.2ms idle=4.3ms
SELECT l0."id", l0."url", l0."title", l0."description", l0."img_preview_url", l0."idea_id", l0."inserted_at", l0."updated_at", l0."idea_id" FROM "links" AS l0 WHERE (l0."idea_id" = ANY($1)) [["5edcf1a3-9d73-437f-8b86-b60875757b01", "6af93d2a-879d-4ac4-9078-a8659f84b38f", "ced4588c-b8ee-4c05-b910-134365649301", "ad3f93fc-54bd-4e2a-8e2d-f818375cc353", "c2d13754-b5b9-467d-bbb4-1f26b9dd6f86", "3028f9a1-1f4a-457e-b548-026500979d4f", "408c9f14-33ba-4a7b-bf7a-a2ddacfb7ab9", "e5f01ac1-6763-40e5-b5e4-c52ed0f3749b", "967b1d37-fce1-4071-82c2-332e463a431c", "d8ca932e-c069-4d42-91a7-719c146c47a5", "fb7fff0b-a0e6-45f0-bfed-99bb58eb9d03", "73cff1b7-570c-477d-8a94-1063ba529c78", "d6200337-8f10-4c15-90ce-b990c7a2335c", "d129ae49-fd23-462d-b16c-75d8e5e230e0", "7a1e6312-e0e0-45ad-ade7-c5d8298fd28d", "65c32039-8ae3-4486-b1b0-b90bcf8b4d0f"]]
[debug] QUERY OK source="idea_labels" db=0.3ms idle=4.9ms
SELECT i0."id", i0."name", i0."color", i0."position_order", i0."brainstorming_id", i0."inserted_at", i0."updated_at", i1."idea_id"::uuid FROM "idea_labels" AS i0 INNER JOIN "idea_idea_labels" AS i1 ON i0."id" = i1."idea_label_id" WHERE (i1."idea_id" = ANY($1)) ORDER BY i1."idea_id"::uuid [["5edcf1a3-9d73-437f-8b86-b60875757b01", "6af93d2a-879d-4ac4-9078-a8659f84b38f", "ced4588c-b8ee-4c05-b910-134365649301", "ad3f93fc-54bd-4e2a-8e2d-f818375cc353", "c2d13754-b5b9-467d-bbb4-1f26b9dd6f86", "3028f9a1-1f4a-457e-b548-026500979d4f", "408c9f14-33ba-4a7b-bf7a-a2ddacfb7ab9", "e5f01ac1-6763-40e5-b5e4-c52ed0f3749b", "967b1d37-fce1-4071-82c2-332e463a431c", "d8ca932e-c069-4d42-91a7-719c146c47a5", "fb7fff0b-a0e6-45f0-bfed-99bb58eb9d03", "73cff1b7-570c-477d-8a94-1063ba529c78", "d6200337-8f10-4c15-90ce-b990c7a2335c", "d129ae49-fd23-462d-b16c-75d8e5e230e0", "7a1e6312-e0e0-45ad-ade7-c5d8298fd28d", "65c32039-8ae3-4486-b1b0-b90bcf8b4d0f"]]
[debug] Replied in 2ms
[debug] QUERY OK source="likes" db=0.2ms idle=5.4ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "65c32039-8ae3-4486-b1b0-b90bcf8b4d0f"]
[debug] QUERY OK source="likes" db=0.2ms idle=5.8ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "7a1e6312-e0e0-45ad-ade7-c5d8298fd28d"]
[debug] QUERY OK source="likes" db=0.1ms idle=5.6ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "d129ae49-fd23-462d-b16c-75d8e5e230e0"]
[debug] QUERY OK source="likes" db=0.1ms idle=5.5ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "d6200337-8f10-4c15-90ce-b990c7a2335c"]
[debug] QUERY OK source="likes" db=0.1ms idle=5.3ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "73cff1b7-570c-477d-8a94-1063ba529c78"]
[debug] QUERY OK source="likes" db=0.1ms idle=5.3ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "fb7fff0b-a0e6-45f0-bfed-99bb58eb9d03"]
[debug] QUERY OK source="likes" db=0.1ms idle=4.9ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "d8ca932e-c069-4d42-91a7-719c146c47a5"]
[debug] QUERY OK source="likes" db=0.2ms idle=4.7ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "967b1d37-fce1-4071-82c2-332e463a431c"]
[debug] QUERY OK source="likes" db=0.2ms idle=5.1ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "e5f01ac1-6763-40e5-b5e4-c52ed0f3749b"]
[debug] QUERY OK source="likes" db=0.1ms idle=5.5ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "408c9f14-33ba-4a7b-bf7a-a2ddacfb7ab9"]
[debug] QUERY OK source="likes" db=0.1ms idle=4.6ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "3028f9a1-1f4a-457e-b548-026500979d4f"]
[debug] QUERY OK source="likes" db=0.1ms idle=4.4ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "c2d13754-b5b9-467d-bbb4-1f26b9dd6f86"]
[debug] QUERY OK source="likes" db=0.1ms idle=4.4ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "ad3f93fc-54bd-4e2a-8e2d-f818375cc353"]
[debug] QUERY OK source="likes" db=0.1ms idle=4.4ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "ced4588c-b8ee-4c05-b910-134365649301"]
[debug] QUERY OK source="likes" db=0.1ms idle=4.4ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "6af93d2a-879d-4ac4-9078-a8659f84b38f"]
[debug] QUERY OK source="likes" db=0.1ms idle=4.3ms
SELECT TRUE FROM "likes" AS l0 WHERE ((l0."user_id" = $1) AND (l0."idea_id" = $2)) LIMIT 1 ["cd21937f-d428-4deb-96e5-bf7e7559817b", "5edcf1a3-9d73-437f-8b86-b60875757b01"]

software design

  • use components more
  • context untangling: Lane uses mainly things from the Brainstorming context, similar to Ideas - normally the main schemas belong to the context, but untangling that is always tough. Perhaps Brainstorming is just too big of a context as it encompasses almost all? 🤔
  • Do the inspirations/teasers need to live in the database? Is there an interface to create more? Otherwise I'd make them static data saving us a database access.

Code Style

  • move to main branch
  • Maybe run credo in strict mode?
Strict mode credo output
# mix credo --strict
Checking 82 source files (this might take a while) ...

  Software Design                                                                                                                                                                            
┃ 
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       lib/mindwendel_web/live/brainstorming_live/show.ex:13:23 #(MindwendelWeb.BrainstormingLive.Show.mount)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       lib/mindwendel_web/plugs/set_session_device_id.ex:11:9 #(Mindwendel.Plugs.SetSessionUserId.call)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       lib/mindwendel_web/plugs/set_session_device_id.ex:9:10 #(Mindwendel.Plugs.SetSessionUserId.call)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       lib/mindwendel_web/controllers/static_page_controller.ex:11:10 #(MindwendelWeb.StaticPageController.home)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       lib/mindwendel_web/controllers/brainstorming_controller.ex:8:7 #(MindwendelWeb.BrainstormingController.create)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       lib/mindwendel_web/controllers/admin/brainstorming_controller.ex:37:23 #(MindwendelWeb.Admin.BrainstormingController.fetch_user)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       test/support/data_case.ex:34:7 #(Mindwendel.DataCase)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       test/support/data_case.ex:31:11 #(Mindwendel.DataCase)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       test/support/conn_case.ex:38:7 #(MindwendelWeb.ConnCase)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       test/support/conn_case.ex:35:11 #(MindwendelWeb.ConnCase)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       test/support/channel_case.ex:35:7 #(MindwendelWeb.ChannelCase)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       test/support/channel_case.ex:32:11 #(MindwendelWeb.ChannelCase)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       test/mindwendel_web/controllers/static_page_controller_test.exs:53:11 #(MindwendelWeb.StaticPageControllerTest)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       test/mindwendel_web/controllers/static_page_controller_test.exs:38:11 #(MindwendelWeb.StaticPageControllerTest)
┃ [D] ↘ Nested modules could be aliased at the top of the invoking module.
┃       test/mindwendel_web/controllers/static_page_controller_test.exs:15:14 #(MindwendelWeb.StaticPageControllerTest)

  Code Readability                                                                                                                                                                           
┃ 
┃ [R] ↘ Do not use parentheses when defining a function which has no arguments.
┃       lib/mindwendel_web/plugs/set_response_header_content_security_policy.ex:78:7 #(Mindwendel.Plugs.SetResponseHeaderContentSecurityPolicy.get_websocket_scheme)
┃ [R] ↘ Line is too long (max is 120, was 123).
┃       lib/mindwendel_web/live/brainstorming_live/show.ex:86:121 #(MindwendelWeb.BrainstormingLive.Show.handle_info)
┃ [R] ↘ Line is too long (max is 120, was 135).
┃       lib/mindwendel_web/live/brainstorming_live/show.ex:63:121 #(MindwendelWeb.BrainstormingLive.Show.handle_info)
┃ [R] ↘ Line is too long (max is 120, was 128).
┃       lib/mindwendel/accounts.ex:152:121 #(Mindwendel.Accounts.user_has_active_brainstormings)
┃ [R] ↘ Line is too long (max is 120, was 204).
┃       lib/mindwendel/accounts.ex:133:121 #(Mindwendel.Accounts.delete_inactive_users)
┃ [R] ↘ The alias `Mindwendel.Repo` is not alphabetically ordered among its group.
┃       test/support/factory.ex:2:9 #(Mindwendel.Factory)
┃ [R] ↘ The alias `Mindwendel.Factory` is not alphabetically ordered among its group.
┃       test/mindwendel_web/live/brainstorming_live_test.exs:6:9 #(MindwendelWeb.BrainstormingLiveTest)
┃ [R] ↘ Do not use parentheses when defining a function which has no arguments.
┃       lib/mindwendel_web/plugs/set_response_header_content_security_policy.ex:71:7 #(Mindwendel.Plugs.SetResponseHeaderContentSecurityPolicy.get_port)
┃ [R] ↘ Do not use parentheses when defining a function which has no arguments.
┃       lib/mindwendel_web/plugs/set_response_header_content_security_policy.ex:64:7 #(Mindwendel.Plugs.SetResponseHeaderContentSecurityPolicy.get_scheme)
┃ [R] ↘ Do not use parentheses when defining a function which has no arguments.
┃       lib/mindwendel_web/plugs/set_response_header_content_security_policy.ex:58:7 #(Mindwendel.Plugs.SetResponseHeaderContentSecurityPolicy.get_style_src)
┃ [R] ↘ Do not use parentheses when defining a function which has no arguments.
┃       lib/mindwendel_web/plugs/set_response_header_content_security_policy.ex:52:7 #(Mindwendel.Plugs.SetResponseHeaderContentSecurityPolicy.get_script_src)
┃ [R] ↘ Do not use parentheses when defining a function which has no arguments.
┃       lib/mindwendel_web/plugs/set_response_header_content_security_policy.ex:45:7 #(Mindwendel.Plugs.SetResponseHeaderContentSecurityPolicy.get_host)
┃ [R] ↘ Line is too long (max is 120, was 149).
┃       lib/mindwendel_web/plugs/set_response_header_content_security_policy.ex:28:121 #(Mindwendel.Plugs.SetResponseHeaderContentSecurityPolicy.content_security_policy_directives)
┃ [R] ↘ Do not use parentheses when defining a function which has no arguments.
┃       lib/mindwendel_web/plugs/set_response_header_content_security_policy.ex:18:7 #(Mindwendel.Plugs.SetResponseHeaderContentSecurityPolicy.content_security_policy_directives)
┃ [R] ↘ The alias `Mindwendel.Ideas` is not alphabetically ordered among its group.
┃       lib/mindwendel_web/live/idea_live/index_component.ex:5:9 #(MindwendelWeb.IdeaLive.IndexComponent)
┃ [R] ↘ The alias `Mindwendel.Ideas` is not alphabetically ordered among its group.
┃       lib/mindwendel_web/live/brainstorming_live/show.ex:6:9 #(MindwendelWeb.BrainstormingLive.Show)
┃ [R] ↘ The alias `Mindwendel.Brainstormings.IdeaLabelFactory` is not alphabetically ordered among its group.
┃       lib/mindwendel_web/live/admin/brainstorming_live/edit.ex:4:9 #(MindwendelWeb.Admin.BrainstormingLive.Edit)
┃ [R] ↘ Line is too long (max is 120, was 122).
┃       lib/mindwendel/likes.ex:59:121 #(Mindwendel.Likes.delete_like)
┃ [R] ↘ The alias `Mindwendel.Brainstormings.Like` is not alphabetically ordered among its group.
┃       lib/mindwendel/ideas.ex:10:9 #(Mindwendel.Ideas)
┃ [R] ↘ The alias `Mindwendel.Brainstormings.IdeaLabel` is not alphabetically ordered among its group.
┃       lib/mindwendel/brainstormings/idea.ex:6:9 #(Mindwendel.Brainstormings.Idea)
┃ [R] ↘ Line is too long (max is 120, was 125).
┃       lib/mindwendel/brainstormings/brainstorming.ex:18:121 #(Mindwendel.Brainstormings.Brainstorming)
┃ [R] ↘ The alias `Mindwendel.Brainstormings.IdeaLabel` is not alphabetically ordered among its group.
┃       lib/mindwendel/brainstormings/brainstorming.ex:7:9 #(Mindwendel.Brainstormings.Brainstorming)
┃ [R] ↘ The alias `Mindwendel.Brainstormings.Idea` is not alphabetically ordered among its group.
┃       lib/mindwendel/brainstormings.ex:9:9 #(Mindwendel.Brainstormings)
┃ [R] ↘ The alias `Mindwendel.Repo` is not alphabetically ordered among its group.
┃       lib/mindwendel/accounts.ex:3:9 #(Mindwendel.Accounts)
┃ [R] ↘ The alias `Mindwendel.Repo` is not alphabetically ordered among its group.
┃       test/repo/data_migrations/migrate_idea_labels_to_idea_idea_labels_test.exs:7:9 #(Mindwendel.Repo.DataMigrations.MigrateIdeaLabelsToIdeaIdeaLabelsTest)
┃ [R] ↘ The alias `Mindwendel.Repo` is not alphabetically ordered among its group.
┃       test/repo/data_migrations/migrate_idea_labels_test.exs:6:9 #(Mindwendel.Repo.DataMigrations.MigrateIdealLabelsTest)
┃ [R] ↘ The alias `Mindwendel.Brainstormings` is not alphabetically ordered among its group.
┃       test/mindwendel_web/live/brainstorming_live/show_idea_edit_test.exs:4:9 #(MindwendelWeb.BrainstormingLive.ShowIdeaEditTest)
┃ [R] ↘ The alias `Mindwendel.Repo` is not alphabetically ordered among its group.
┃       test/mindwendel_web/controllers/brainstorming_controller_test.exs:6:9 #(MindwendelWeb.BrainstormingControllerTest)
┃ [R] ↘ The alias `Mindwendel.Factory` is not alphabetically ordered among its group.
┃       test/mindwendel_web/channels/brainstorming_channel_test.exs:4:9 #(MindwendelWeb.BrainstormingChannelTest)
┃ [R] ↘ The alias `Mindwendel.Ideas` is not alphabetically ordered among its group.
┃       test/mindwendel/ideas_test.exs:5:9 #(Mindwendel.IdeasTest)
┃ [R] ↘ The alias `Mindwendel.Ideas` is not alphabetically ordered among its group.
┃       test/mindwendel/idea_test.exs:5:9 #(Mindwendel.IdeaTest)
┃ [R] ↘ The alias `Mindwendel.Ideas` is not alphabetically ordered among its group.
┃       test/mindwendel/idea_labels_test.exs:5:9 #(Mindwendel.IdeaLabelsTest)
┃ [R] ↘ The alias `Mindwendel.Factory` is not alphabetically ordered among its group.
┃       test/mindwendel/csv_formatter_test.exs:3:9 #(MindwendelServices.CSVFormatter)
┃ [R] ↘ The alias `Mindwendel.Factory` is not alphabetically ordered among its group.
┃       test/mindwendel/brainstormings_users_test.exs:3:9 #(Mindwendel.AccountsMergeBrainstormingUserTest)
┃ [R] ↘ The alias `Mindwendel.IdeaLabels` is not alphabetically ordered among its group.
┃       test/mindwendel/brainstormings_test.exs:8:9 #(Mindwendel.BrainstormingsTest)
┃ [R] ↘ The alias `Mindwendel.Brainstormings.IdeaLabel` is not alphabetically ordered among its group.
┃       test/mindwendel/brainstormings/create_brainstorming_test.exs:9:9 #(Mindwendel.Brainstormings.CreateBrainstormingTest)
┃ [R] ↘ The alias `Mindwendel.Brainstormings.BrainstormingModeratingUser` is not alphabetically ordered among its group.
┃       test/mindwendel/brainstormings/create_brainstorming_test.exs:3:9 #(Mindwendel.Brainstormings.CreateBrainstormingTest)
┃ [R] ↘ Line is too long (max is 120, was 138).
┃       test/mindwendel/accounts_test.exs:127:121 #(Mindwendel.AccountsTest)
┃ [R] ↘ Line is too long (max is 120, was 138).
┃       test/mindwendel/accounts_test.exs:109:121 #(Mindwendel.AccountsTest)
┃ [R] ↘ Line is too long (max is 120, was 138).
┃       test/mindwendel/accounts_test.exs:91:121 #(Mindwendel.AccountsTest)
┃ [R] ↘ The alias `Mindwendel.Factory` is not alphabetically ordered among its group.
┃       test/mindwendel/accounts_test.exs:3:9 #(Mindwendel.AccountsTest)
┃ [R] ↘ Do not use parentheses when defining a function which has no arguments.
┃       lib/mindwendel_web/views/static_page.ex:9:7 #(MindwendelWeb.StaticPageView.brainstormings_available_until)
┃ [R] ↘ Line is too long (max is 120, was 124).
┃       lib/mindwendel_web/router.ex:25:121 #(MindwendelWeb.Router)
┃ [R] ↘ Line is too long (max is 120, was 122).
┃       lib/mindwendel_web/router.ex:23:121 #(MindwendelWeb.Router)
┃ [R] ↘ Line is too long (max is 120, was 127).
┃       lib/mindwendel_web/router.ex:21:121 #(MindwendelWeb.Router)
┃ [R] ↘ Line is too long (max is 120, was 162).
┃       lib/mindwendel_web/router.ex:20:121 #(MindwendelWeb.Router)
┃ [R] ↘ The alias `Mindwendel.Brainstormings` is not alphabetically ordered among its group.
┃       lib/mindwendel_web/controllers/brainstorming_controller.ex:3:9 #(MindwendelWeb.BrainstormingController)
┃ [R] ↘ The alias `Mindwendel.Ideas` is not alphabetically ordered among its group.
┃       lib/mindwendel_web/controllers/admin/brainstorming_controller.ex:4:9 #(MindwendelWeb.Admin.BrainstormingController)
┃ [R] ↘ The alias `Mindwendel.Brainstormings` is not alphabetically ordered among its group.
┃       lib/mindwendel/worker/remove_brainstormings_and_users_after_period_worker.ex:3:9 #(Mindwendel.Worker.RemoveBrainstormingsAndUsersAfterPeriodWorker)
┃ [R] ↘ The alias `Mindwendel.Ideas` is not alphabetically ordered among its group.
┃       lib/mindwendel/likes.ex:10:9 #(Mindwendel.Likes)
┃ [R] ↘ The alias `Mindwendel.Brainstormings.Idea` is not alphabetically ordered among its group.
┃       lib/mindwendel/idea_labels.ex:9:9 #(Mindwendel.IdeaLabels)
┃ [R] ↘ The alias `Mindwendel.Repo` is not alphabetically ordered among its group.
┃       lib/mindwendel/help.ex:7:9 #(Mindwendel.Help)
┃ [R] ↘ The alias `Mindwendel.Brainstormings.Idea` is not alphabetically ordered among its group.
┃       lib/mindwendel/brainstormings/like.ex:5:9 #(Mindwendel.Brainstormings.Like)
┃ [R] ↘ The alias `Mindwendel.Brainstormings.Brainstorming` is not alphabetically ordered among its group.
┃       lib/mindwendel/brainstormings/brainstorming_moderating_user.ex:3:9 #(Mindwendel.Brainstormings.BrainstormingModeratingUser)
┃ [R] ↘ The alias `Mindwendel.Brainstormings.Idea` is not alphabetically ordered among its group.
┃       lib/mindwendel/accounts/user.ex:7:9 #(Mindwendel.Accounts.User)
┃ [R] ↘ The alias `Mindwendel.Brainstormings.Brainstorming` is not alphabetically ordered among its group.
┃       lib/mindwendel/accounts/brainstorming_user.ex:3:9 #(Mindwendel.Accounts.BrainstormingUser)

Feature Ideas

  • Submitting ideas via a key combination like <Ctrl> + <Enter> would be awesome
  • Comments are covered in feature: Add comments #296 already I see :)
  • the inspirtational teaser seems static, maybe make it regenerate every time one uncovers it? Or add a regenerate ♻️ button next to it that gets a new one?
  • the inspirational teaser animation for opening/closing is also very choppy even locally, after an upgrade doing it via JS commands/purely client side or so should make it nicer
  • I don't get the color? I can click one of the colors and then it gets a color tag? Or is that just a general tag system with pre defined tages that is just the colors in dev/seeds? Also clicking on them in the top right does nothing (I'd expect them to filter)
  • I think gathering and managing high level ideas for mindwendel on a public mindwendel instance would be cool dog fooding but maybe too much 😁

Dependencies

Switching libraries

Switching libraries usually has little benefit but I still wanted to mention some

  • cowboy - phoenix comes with bandit as a default webserver these days, not sure what the reasons are but probably there are some and migration should be easy from cowboy
  • csv - probably taste but I prefer nimble_csv as it's done by the elixir creators, has some more recent updates, historically more stable and nimbler/smaler iirc :)
  • httpoison - HTTP clients are ever shifting in the elixir space - req is really cool though and where the community seems to be converging (also thanks to a creator from dashbit and giving talks etc, but also good design on top of smaller well written libraires) - if anything I know the library best as I use it at "work-work" to power a pretty massive http proxy
  • oban - I haven't looked yet what Oban is used for, but I wonder if we really need oban. I love oban but depending on what it's used for (I'll check another time) we might get away with genservers if losing in progress tasks is maybe sometimes ok
  • timex - would need to check the Timex usage, but a lot of basic timex functionality is available in elixir itself these days so maybe we can cut a dependency here

Tests

One of my todos to look at. First look we don't seem to have a full integration test?

CI

  • looks like every step may compile (I'll double check) - getting them all together may reduce noise and also finish faster (I'll likely quickly tru this out)
@JannikStreek
Copy link
Member

JannikStreek commented Sep 17, 2024

Thanks, great compilation of our screw ups haha 😄

Some answers to your questions / feedback

  • colors: The thought is similar as in a brainstorming to cluster ideas, e.g. by color. You can change the names of these colors (we call them labels) in the admin area.
  • Idea regarding collecting mindwendel feedback: Love it! Just need to trust your own software 😂 Currently, our own instance only saves for thirty days, but I think depending on activity on the brainstorming.
  • The teasers were a nice gimmick idea but haven't received much love so far / currently too much else to do. So we have deactivated them on our main instance => currently not used much. I still like the idea, especially that maybe some teasers could be generated by AI tools or something. But so far I would put this out of scope.

As it's a lot of feedback (and good one), maybe you can add a small time/complexity assessment, in regards to which are the low hanging fruits. E.g. refactoring the views I would propose to do after my open lane PR. But solving a couple of N+1 would be a good and small improvement. What do you think?

Might be nice to start the migration soon (unless there are deadlines), as otherwise it'll always become more code to change. I think it can be done step by step. Maybe after #344 ?

yes, same thought. But we should not defer it much later.

@JannikStreek
Copy link
Member

Submitting ideas via a key combination like + would be awesome

So you mean after hitting hotkey "I" entering some data, you want "+" to submit the idea? or maybe control + enter?

@JannikStreek
Copy link
Member

Btw: I just used the live generator for the lanes which also generated the core_components which you mentioned, see 47c616f

@PragTob
Copy link
Collaborator Author

PragTob commented Sep 18, 2024

@JannikStreek lmao... I wrote <Ctrl> + <Enter> but without the code fences and of course they are interpreted as HTML tags then and not shown... fixing now but yes I meant ctrl + enter

@PragTob
Copy link
Collaborator Author

PragTob commented Sep 18, 2024

@JannikStreek as for the time/complexity/effort estimations tough to do when I don't know the app as well yet I can give it a shot but it'll be off even more than normal :)

@PragTob
Copy link
Collaborator Author

PragTob commented Nov 30, 2024

@JannikStreek added a question about whether the teasers/inspirations really need to live in the database or could just be static data (aka, who modifies them/inserts new ones?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants