-
Notifications
You must be signed in to change notification settings - Fork 6
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
Created Algorithm for Potential Partners in Beta Register Page #1177
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,27 @@ config :animina, :ai_message_help_price, 20 | |
# Configures whether to have ai automatically respond to messages | ||
config :animina, :autoreply_messages_with_ai, false | ||
|
||
# Configures default maximum age for potential partners | ||
config :animina, :default_potential_partner_maximum_age, 100 | ||
|
||
# Configures default minimum age for potential partners | ||
config :animina, :default_potential_partner_minimum_age, 18 | ||
|
||
# confugures the difference in age if no maximum or minimum age is set | ||
config :animina, :default_potential_partner_age_difference, 10 | ||
|
||
# Configures the maximum height for potential partners | ||
config :animina, :default_potential_partner_maximum_height, 300 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 300 as a default doesn't make any sense. Make it 120 please. PS: There will come the day when I get an email from a user who has a height of 121 cm. I am so sure! ;-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case we want a value so huge that will make sure we do not leave out any users , we also use this value as the default maximum height in the query , this allows us to select all users below 300 cm , I think it would be best to have a very high value for this case , thoughts? @wintermeyer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A quick google research let to the number 251. That seems to be the height human right now. Let's go with 225 cm since the heightest German right now seems to be 224. |
||
|
||
# Configures the minimum height for potential partners | ||
config :animina, :default_potential_partner_minimum_height, 0 | ||
wintermeyer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Configures the maximum height difference for potential partners | ||
config :animina, :default_potential_partner_height_difference, 10 | ||
|
||
# Configures the default search range for potential partners | ||
config :animina, :default_potential_partner_search_range, 10_000 | ||
wintermeyer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
config :animina, | ||
ecto_repos: [Animina.Repo], | ||
generators: [timestamp_type: :utc_datetime] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ defmodule AniminaWeb.BetaRegistrationComponents do | |
|
||
<h2 class="text-2xl mt-3 font-semibold dark:text-white"> | ||
<%= with_locale(@language, fn -> %> | ||
<%= gettext("Current Potential Partners:") %> 123 | ||
<%= gettext("Current Potential Partners:") %> <%= @number_of_potential_partners %> | ||
<% end) %> | ||
</h2> | ||
|
||
|
@@ -37,7 +37,7 @@ defmodule AniminaWeb.BetaRegistrationComponents do | |
id="beta_user_registration_form" | ||
for={@form} | ||
class="space-y-6 mt-6 group " | ||
phx-change="validate" | ||
phx-change="validate_and_filter_potential_partners" | ||
phx-submit="submit" | ||
> | ||
<h2 class="text-2xl mt-3 font-semibold dark:text-white"> | ||
|
@@ -209,7 +209,7 @@ defmodule AniminaWeb.BetaRegistrationComponents do | |
</span> | ||
</label> | ||
<div phx-feedback-for={@f[:height].name} class="mt-2 w-[100%]"> | ||
<%= text_input(@f, :height, | ||
<%= number_input(@f, :height, | ||
class: | ||
"block w-full rounded-md border-0 py-1.5 text-gray-900 dark:bg-gray-700 dark:text-white shadow-sm ring-1 ring-inset placeholder:text-gray-400 focus:ring-2 focus:ring-inset sm:text-sm phx-no-feedback:ring-gray-300 phx-no-feedback:focus:ring-indigo-600 sm:leading-6 " <> | ||
unless(get_field_errors(@f[:height], :height) == [], | ||
|
@@ -319,28 +319,32 @@ defmodule AniminaWeb.BetaRegistrationComponents do | |
~H""" | ||
<div> | ||
<label | ||
for="form_minimum_partner_age" | ||
for="form_minimum_partner_height" | ||
class="block text-sm font-medium leading-6 text-gray-900 dark:text-white" | ||
> | ||
<%= with_locale(@language, fn -> %> | ||
<%= gettext("Minimum age") %> | ||
<%= gettext("Minimum height") %> | ||
<% end) %> | ||
</label> | ||
<div phx-feedback-for={@f[:minimum_partner_age].name} class="mt-2"> | ||
<%= select(@f, :minimum_partner_age, Enum.map(18..110, &{&1, &1}), | ||
prompt: with_locale(@language, fn -> gettext("doesn't matter") end), | ||
value: @f[:minimum_partner_age].value, | ||
<div phx-feedback-for={@f[:minimum_partner_height].name} class="mt-2"> | ||
<%= select( | ||
@f, | ||
:minimum_partner_height, | ||
[{with_locale(@language, fn -> gettext("doesn't matter") end), nil}] ++ | ||
Enum.map(140..210, &{"#{&1} cm", &1}), | ||
class: | ||
"block w-full rounded-md border-0 py-1.5 text-gray-900 dark:bg-gray-700 dark:text-white shadow-sm ring-1 ring-inset focus:ring-2 focus:ring-inset phx-no-feedback:ring-gray-300 phx-no-feedback:focus:ring-indigo-600 sm:text-sm sm:leading-6 " <> | ||
unless(get_field_errors(@f[:minimum_partner_age], :minimum_partner_age) == [], | ||
"block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset focus:ring-2 dark:bg-gray-700 dark:text-white focus:ring-inset phx-no-feedback:ring-gray-300 phx-no-feedback:focus:ring-indigo-600 sm:text-sm sm:leading-6 " <> | ||
unless( | ||
get_field_errors(@f[:minimum_partner_height], :minimum_partner_height) == [], | ||
do: "ring-red-600 focus:ring-red-600", | ||
else: "ring-gray-300 focus:ring-indigo-600" | ||
) | ||
), | ||
autofocus: true | ||
) %> | ||
|
||
<.error :for={msg <- get_field_errors(@f[:minimum_partner_age], :minimum_partner_age)}> | ||
<.error :for={msg <- get_field_errors(@f[:minimum_partner_height], :minimum_partner_height)}> | ||
<%= with_locale(@language, fn -> %> | ||
<%= gettext("Minimum age") <> " " <> msg %> | ||
<%= gettext("Minimum height") <> " " <> msg %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please ALWAYS(!) use something like |
||
<% end) %> | ||
</.error> | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean? If I am 50 years old will that mean that the range is from 40 - 60 or is it from 45 - 55? Either improve the actual code or add a better comment to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means range is from 40 and 60 , Kindly advise on the best naming to have in this case @wintermeyer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call it
default_partner_height_offset
Not perfect but good for now.