Created
May 12, 2016 03:21
-
-
Save mattyulrich/95cea7cbbf60520cbdc8e6a7ffcb9fd9 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
(in-ns 'cljs-problem.app) | |
=> nil | |
target-app-state | |
=> | |
{:current-user {:user-id 123, :user-name "John"}, | |
:selected-class {:class-id 1, | |
:class-name "Learning Om", | |
:teacher {:user-id 456, :user-name "Fred"}, | |
:students [{:user-id 789, :user-name "Jill"} {:user-id 963, :user-name "Mary"}]}, | |
:classes [{:class-id 1, | |
:class-name "Learning Om", | |
:teacher {:user-id 456, :user-name "Fred"}, | |
:students [{:user-id 789, :user-name "Jill"} {:user-id 963, :user-name "Mary"}]} | |
{:class-id 2, | |
:class-name "Not Being Confused", | |
:teacher {:user-id 246, :user-name "Jane"}, | |
:students [{:user-id 867, :user-name "Carl"} {:user-id 309, :user-name "Gretchen"}]}]} | |
(pp/pprint (om/tree->db App-Content target-app-state true)) | |
WARNING: Use of undeclared Var cljs-problem.app/App-Content at line 1 <cljs repl> | |
{:current-user [:user/by-id 123], | |
:selected-class [:class/by-id 1], | |
:classes [[:class/by-id 1] [:class/by-id 2]], | |
:user/by-id | |
{867 {:user-id 867, :user-name "Carl"}, | |
963 {:user-id 963, :user-name "Mary"}, | |
456 {:user-id 456, :user-name "Fred"}, | |
309 {:user-id 309, :user-name "Gretchen"}, | |
789 {:user-id 789, :user-name "Jill"}, | |
246 {:user-id 246, :user-name "Jane"}, | |
123 {:user-id 123, :user-name "John"}}, | |
:class/by-id | |
{1 | |
{:class-id 1, | |
:class-name "Learning Om", | |
:teacher [:user/by-id 456], | |
:students [[:user/by-id 789] [:user/by-id 963]]}, | |
2 | |
{:class-id 2, | |
:class-name "Not Being Confused", | |
:teacher [:user/by-id 246], | |
:students [[:user/by-id 867] [:user/by-id 309]]}}, | |
:om.next/tables #{:user/by-id :class/by-id}} | |
=> nil | |
(def query (om/get-query Class-Information)) | |
WARNING: Use of undeclared Var cljs-problem.app/Class-Information at line 1 <cljs repl> | |
=> #'cljs-problem.app/query | |
query | |
=> [:class-id :class-name {:teacher [:user-id :user-name]} {:students [:user-id :user-name]}] | |
(om/db->tree query (get @(om/app-state reconciler) :selected-class) @(om/app-state reconciler)) | |
=> {:class-id 1, :class-name "Learning Om", :teacher {:user-id 456, :user-name "Fred"}, :students [{} {}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment