]> gitweb.michael.orlitzky.com - mailshears.git/commitdiff
Add a missing space in the header.
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 19 Mar 2013 15:56:04 +0000 (11:56 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 19 Mar 2013 15:56:04 +0000 (11:56 -0400)
One more try at retrieving the DAViCal principal_id.

bin/mailshears
lib/mailshears/plugins/davical.rb

index c033f5e639491210b33cda1e69512179798c8f5c..5d1c7982dd6978939fce3edbeb9480d68c4e19f8 100755 (executable)
@@ -73,7 +73,7 @@ Plugin.includers.each do |plugin_class|
       header += current_time.to_s
     end
 
-    header += '(Plugin: ' + plugin_class.to_s + ")\n"
+    header += ' (Plugin: ' + plugin_class.to_s + ")\n"
     puts header
     puts '-' * header.size # Underline the header.
 
index fae30d8f794d3667b835773157ed2b801f5855ed..0c63ee2f60da764a1d10fbdc42ca354a2c2f2f07 100644 (file)
@@ -26,12 +26,12 @@ class DavicalDb
 
 
   def describe_account(account)
-    user_id = self.get_principal_id(account)
+    principal_id = self.get_principal_id(account)
 
-    if user_id.nil?
+    if principal_id.nil?
       return 'User not found'
     else
-      return "Principal ID: #{user_id}"
+      return "Principal ID: #{principal_id}"
     end
   end
 
@@ -97,7 +97,10 @@ class DavicalDb
                                   @db_user,
                                   @db_pass)
 
-      sql_query = "SELECT principal_id FROM principal WHERE username = $1;"
+      sql_query =  "SELECT principal.principal_id "
+      sql_query += "FROM (principal INNER JOIN usr "
+      sql_query += "      ON principal.user_no = usr.user_no) "
+      sql_query += "WHERE usr.username = $1;"
 
       connection.query(sql_query, [account]) do |result|
         if result.num_tuples > 0