Virtual Card in Plus Context

Support Ticket

+status
closed
+tags
 

Not sure if this will work, but I'm trying to make a variant of "right+*rform" called "other+*rform" so that including:

will give me the cards with +discussion plus cards, but skips my type.

http://wiki.flowplace.org/wagn/Topic

{"not": {"type":"Topic"}, "right_plus": "_right" }

But want to get the type of the "_left" card rather than using a literal as above.

 

Ethan noticed that the + card in the middle, Topic+discussion didn't exist.  With that fixed, I was trying to patch it so I could use {"type":"_left"}  This seems to work:

diff --git a/lib/wql2.rb b/lib/wql2.rb

index 736d7f6..d72e9d3 100644

--- a/lib/wql2.rb

+++ b/lib/wql2.rb

@@ -529,7 +529,10 @@ module Wql2

         field = 'r.content'

       when "type"

         v = [v].flatten.map do |val| 

-          Cardtype.classname_for(  val.is_a?(Card::Base) ? val.name : val  

+          vv = val

+          vv = @cardspec.to_card(val).name if val =~ /^_(self|left|right)$/

+          vv = val.name if val.is_a?(Card::Base)

+          Cardtype.classname_for( vv )

         end

         v = v[0] if v.length==1

       when "cond"



New problem, though. With Topic+discussion existing, it lists the "Topic" card, so I tried to add another clause to the search:

{"!=": "_left", "not": {"type": "_left"}, "right_plus": "_right" }

(to recap, _self is "Topic+discussion", and the "not type" works, but "!=" doesn't seem to ...

  --Gerry Gleason.....Thu Nov 05 15:15:02 -0800 2009


"!=" does a content comparison - compares content values. Currently _self, _left, and _right can be card defs but not "values". You can do "!=":"yes", for example. In this case, you basically want "not":"_left", but that has a different problem: you're already using not. It's a multi-value issue. I think we have design for this, but I'd have to look.

  --Ethan McCutchen.....Thu Nov 05 15:34:39 -0800 2009


re the patch, I'd rather not add any more references to self, left, or right in the code. Is there a way to fix this using existing references?

  --Ethan McCutchen.....Thu Nov 05 15:36:55 -0800 2009


Not sure what you mean by "existing references". I think there may be a more general place to put this and get these psuedo values for value refs.

 

Are you also saying that {"not": "_left", "not":{"type": "_left"} ... would not work? I tried that too. Maybe {"not", {"or": {"_left":{"type":"_left"}}}, ... ?

  --Gerry Gleason.....Thu Nov 05 16:35:19 -0800 2009


That was fun:

ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') and tx.trash='f' ) and t.id in (select trunk_id from cards tx where tx.tag' at line 1: (select t.* from cards t where t.id not in (select id from cards tx where () and tx.trash='f' ) and t.id in (select trunk_id from cards tx where tx.tag_id in (select id from cards txx where txx.id = '388' and txx.trash='f' ) and tx.trash='f' ) and t.trash='f' ORDER BY t.updated_at desc LIMIT 50 OFFSET 0)

{"not": {"or": {"_left": {"type": "_left"}}}, "right_plus": "_right" }

  --Gerry Gleason.....Thu Nov 05 16:46:18 -0800 2009


I think this is resolved now. The error was from another problem.

  --Gerry Gleason.....Fri Dec 04 05:23:29 -0800 2009