diff options
author | Alex Legler <alex@a3li.li> | 2016-01-13 15:12:34 +0100 |
---|---|---|
committer | Alex Legler <alex@a3li.li> | 2016-01-13 15:12:34 +0100 |
commit | 5654a02c99fee7d2ee4ac9195c49cafc5fbe3542 (patch) | |
tree | a8ccd03ffc2a82b79bc0b4fa12575867a83bdbb5 | |
parent | A little less conversion 🎶 (diff) | |
download | semantic-data-toolkit-5654a02c99fee7d2ee4ac9195c49cafc5fbe3542.tar.gz semantic-data-toolkit-5654a02c99fee7d2ee4ac9195c49cafc5fbe3542.tar.bz2 semantic-data-toolkit-5654a02c99fee7d2ee4ac9195c49cafc5fbe3542.zip |
Make project member role optional
-rwxr-xr-x | projects.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/projects.rb b/projects.rb index 45d121b..c922a5c 100755 --- a/projects.rb +++ b/projects.rb @@ -34,11 +34,12 @@ def query_members(project_uri) Query.new do pattern [RDF::URI.new(project_uri), GentooWiki::SUBOBJECT, :member_subobj_uri] pattern [:member_subobj_uri, GentooWiki::PROP_DEV, :member_uri] - pattern [:member_subobj_uri, GentooWiki::PROP_ROLE, :member_roles] pattern [:member_subobj_uri, GentooWiki::PROP_LEAD, :member_is_lead] pattern [:member_uri, GentooWiki::PROP_NICK, :member_nick] pattern [:member_uri, GentooWiki::PROP_NAME, :member_name] pattern [:member_uri, GentooWiki::PROP_CONTACT, :member_email] + + pattern [:member_subobj_uri, GentooWiki::PROP_ROLE, :member_roles], optional: true end end @@ -72,13 +73,15 @@ projects_q.execute(graph) do |result| project['members'] = [] query_members(result[:proj_uri]).execute(graph) do |member_result| - project['members'] << { + member_hash = { 'nickname' => member_result[:member_nick].to_s, - 'role' => member_result[:member_roles].to_s, 'is_lead' => member_result[:member_is_lead].to_s == 'true', 'email' => email(member_result[:member_email].to_s), 'name' => member_result[:member_name].to_s } + + member_hash['role'] = member_result[:member_roles].to_s if member_result.key? :member_roles + project['members'] << member_hash end projects[project_id] = project |