Work on fixing menus revealed inconsistency in finding farside.

This commit is contained in:
Simon Brooke 2018-10-03 12:59:20 +01:00
parent dc4937dfa2
commit 43d46ca9e5
3 changed files with 9 additions and 39 deletions

View file

@ -94,11 +94,7 @@
(defn emit-entity-field-type
"Emit an appropriate field type for this `property`, expected to reference an entity, in this `application`."
[property application]
(let [farside (child
application
#(and
(entity? %)
(= (:name (:attrs %)) (:entity (:attrs property)))))
(let [farside (entity-for-property property application)
key-properties (children-with-tag
(first (children-with-tag farside :key))
:property)]
@ -229,11 +225,7 @@
(defn compose-convenience-entity-field
[field entity application]
(let [farside (child
application
#(and
(entity? %)
(= (:name (:attrs %)) (:entity (:attrs field)))))]
(let [farside (entity-for-property (property-for-field field entity) application)]
(flatten
(map
(fn [f]
@ -355,11 +347,7 @@
(map
(fn [f]
(let
[farside (child
application
#(and
(entity? %)
(= (:name (:attrs %)) (:entity (:attrs f)))))]
[farside (entity-for-property f application)]
(str
(safe-name (:table (:attrs entity)) :sql)
"."

View file

@ -110,7 +110,7 @@
(query-name e :search-strings)
(query-name e :search-strings)
(keyword (-> property :attrs :farkey))
(list (keyword (-> property :attrs :name)) 'params)))
(list (keyword (-> property :attrs :name)) 'record)))
{})
;; "link" (list
;; 'do
@ -141,9 +141,7 @@
:property
#(= (-> % :attrs :name) p-name))
f-name (-> property :attrs :entity)
farside (child-with-tag application
:entity
#(= (-> % :attrs :name) f-name))]
farside (entity-for-property property application)]
(if (and (entity? entity) (entity? farside))
(list 'if (list 'all-keys-present? 'params (key-names entity true))
(hash-map

View file

@ -264,12 +264,7 @@
(let
[type (:type (:attrs property))
farname (:entity (:attrs property))
farside (first
(children
application
#(and
(= (:tag %) :entity)
(= (:name (:attrs %)) farname))))
farside (entity-for-property property application)
fs-distinct (user-distinct-properties farside)
farkey (or
(:farkey (:attrs property))
@ -322,10 +317,7 @@
[issue 47](https://github.com/simon-brooke/youyesyet/issues/47)."
[property form entity application]
(let [farname (:entity (:attrs property))
farside (first
(children
application
#(= (:name (:attrs %)) farname)))
farside (entity-for-property property application)
magnitude (try
(read-string (:magnitude (:attrs farside)))
(catch Exception _ 7))
@ -597,12 +589,7 @@
#(=
(-> % :attrs :name)
(-> auxlist :attrs :property)))
farside (child-with-tag
application
:entity
#(=
(-> % :attrs :name)
(-> property :attrs :entity)))]
farside (entity-for-property property application)]
(if
(and property farside)
{:tag :div
@ -771,10 +758,7 @@
(-> field :attrs :property)
(-> % :attrs :name)))
farname (:entity (:attrs property))
farside (first
(children
application
#(= (:name (:attrs %)) farname)))
farside (entity-for-property property application)
magnitude (try
(read-string
(:magnitude