| 
					
				 | 
			
			
				@@ -33,17 +33,17 @@ object Card { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   def list() = DB.withConnection { implicit c => 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     val list = SQL(""" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      select words.word as word, taboo.word as taboo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      select words.id as id, words.word as word, taboo.word as taboo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       from words left join taboo on word_id = words.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     """) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    .list(str("word") ~ str("taboo") map flatten) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    .list(int("id") ~ str("word") ~ str("taboo") map flatten) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     mapToCard(list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  def mapToCard(seq: Seq[(String, String)]) = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  def mapToCard(seq: Seq[(Int, String, String)]) = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     seq.groupBy(_._1).map { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      case (word, taboos) => Card(word, taboos.map(_._2).toSet) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      case (id, taboos) => Card(taboos.map(_._2).head, taboos.map(_._3).toSet) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }.toList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |