[openstreetmap/openstreetmap-website] Microcosms microcosms (PR #3683)

Brian DeRocher notifications at github.com
Sun Sep 18 18:52:39 UTC 2022


@openbrian commented on this pull request.



> +
+  load_and_authorize_resource :except => [:create, :new]
+  authorize_resource
+
+  def index
+    # TODO: OMG is the math right here?
+    minute_of_day = "(60 * EXTRACT(HOUR FROM current_timestamp) + EXTRACT(MINUTE FROM current_timestamp))"
+    morning = "(60 * 6)" # 6 AM
+    long_facing_sun = "(#{minute_of_day} + #{morning}) / 4"
+    # Using Arel.sql here because we're using known-safe values.
+    @microcosms = Microcosm.order(Arel.sql("longitude + 180 + #{long_facing_sun} DESC"))
+
+    @microcosms_i_organize = current_user ? current_user.microcosms_i_organize : []
+  end
+
+  def of_user

done

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3683#discussion_r973761320
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/3683/review/1111576307 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220918/211c2118/attachment-0001.htm>


More information about the rails-dev mailing list