From 5654a02c99fee7d2ee4ac9195c49cafc5fbe3542 Mon Sep 17 00:00:00 2001 From: Alex Legler Date: Wed, 13 Jan 2016 15:12:34 +0100 Subject: Make project member role optional --- projects.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'projects.rb') 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 -- cgit v1.2.3-65-gdbad