Permalink
Browse files

Fixing some spacing and text and other minor stuff.

  • Loading branch information...
1 parent d3616f6 commit ead4cdedf2dc72897237b77e5e816048a0f38b70 @jaredbischof jaredbischof committed Mar 1, 2013
Showing with 29 additions and 22 deletions.
  1. +14 −14 src/MGRAST/lib/resources2/project.pm
  2. +9 −3 src/MGRAST/lib/resources2/status.pm
  3. +6 −5 src/MGRAST/lib/resources2/user.pm
@@ -182,23 +182,23 @@ sub prepare_data {
if ($self->cgi->param('verbosity')) {
if ($self->cgi->param('verbosity') eq 'full') {
- my @jobs = map { ["mgm".$_, $url.'/metagenome/mgm'.$_] } @{ $project->all_metagenome_ids };
- my @colls = @{ $project->collections };
- my @samples = map { ["mgs".$_->{ID}, $url."/sample/mgs".$_->{ID}] } grep { $_ && ref($_) && ($_->{type} eq 'sample') } @colls;
- my @libraries = map { ["mgl".$_->{ID}, $url."/library/mgl".$_->{ID}] } grep { $_ && ref($_) && ($_->{type} eq 'library') } @colls;
- $obj->{analyzed} = \@jobs;
- $obj->{samples} = \@samples;
- $obj->{libraries} = \@libraries;
+ my @jobs = map { ["mgm".$_, $url.'/metagenome/mgm'.$_] } @{ $project->all_metagenome_ids };
+ my @colls = @{ $project->collections };
+ my @samples = map { ["mgs".$_->{ID}, $url."/sample/mgs".$_->{ID}] } grep { $_ && ref($_) && ($_->{type} eq 'sample') } @colls;
+ my @libraries = map { ["mgl".$_->{ID}, $url."/library/mgl".$_->{ID}] } grep { $_ && ref($_) && ($_->{type} eq 'library') } @colls;
+ $obj->{analyzed} = \@jobs;
+ $obj->{samples} = \@samples;
+ $obj->{libraries} = \@libraries;
}
if (($self->cgi->param('verbosity') eq 'verbose') || ($self->cgi->param('verbosity') eq 'full')) {
- my $metadata = $project->data();
- my $desc = $metadata->{project_description} || $metadata->{study_abstract} || " - ";
- my $fund = $metadata->{project_funding} || " - ";
- $obj->{metadata} = $metadata;
- $obj->{description} = $desc;
- $obj->{funding_source} = $fund;
+ my $metadata = $project->data();
+ my $desc = $metadata->{project_description} || $metadata->{study_abstract} || " - ";
+ my $fund = $metadata->{project_funding} || " - ";
+ $obj->{metadata} = $metadata;
+ $obj->{description} = $desc;
+ $obj->{funding_source} = $fund;
} elsif ($self->cgi->param('verbosity') ne 'minimal') {
- $self->return_data( {"ERROR" => "invalid value for option verbosity"}, 400 );
+ $self->return_data( {"ERROR" => "invalid value for option verbosity"}, 400 );
}
}
push @$objects, $obj;
@@ -17,6 +17,12 @@ sub new {
# Add name / attributes
$self->{name} = "status";
+ $self->{attributes} = { "id" => [ 'integer', 'process id' ],
+ "status" => [ 'string', 'cv', [ ['processing', 'process is still computing'],
+ ['done', 'process is done computing'] ] ],
+ "url" => [ 'url', 'resource location of this object instance'],
+ "data" => [ 'hash', 'if status is done, data holds the result, otherwise data is not present']
+ };
return $self;
}
@@ -95,15 +101,15 @@ sub prepare_data {
my $obj = {};
if ($process_status ne "") {
$obj->{id} = $id;
- $obj->{status} = "Processing";
+ $obj->{status} = "processing";
$obj->{url} = $self->cgi->url."/".$self->name."/".$id;
} elsif ($process_status eq "" && $self->cgi->param('verbosity') && ($self->cgi->param('verbosity') eq 'minimal')) {
$obj->{id} = $id;
- $obj->{status} = "Done";
+ $obj->{status} = "done";
$obj->{url} = $self->cgi->url."/".$self->name."/".$id;
} else {
$obj->{id} = $id;
- $obj->{status} = "Done";
+ $obj->{status} = "done";
$obj->{url} = $self->cgi->url."/".$self->name."/".$id;
local $/;
open my $fh, "<", $fname;
@@ -5,6 +5,7 @@ use warnings;
no warnings('once');
use Conf;
+use Data::Dumper;
use parent qw(resources2::resource);
use WebApplicationDBHandle;
use DBMaster;
@@ -73,24 +74,24 @@ sub instance {
my $id = $rest->[0];
if ($rest && scalar(@$rest) == 1) {
- unless ($self->user && $self->user->has_right(undef, 'edit', 'user', $self->user->{_id})) {
- $self->return_data( {"ERROR" => "insufficient permissions for user call"}, 400 );
- }
+ unless ($self->user && $self->user->has_right(undef, 'edit', 'user', $self->user->{_id})) {
+ $self->return_data( {"ERROR" => "insufficient permissions for user call"}, 400 );
+ }
}
use WebApplicationDBHandle;
use DBMaster;
my ($dbmaster, $error) = WebApplicationDBHandle->new();
if ($error) {
- $self->return_data( {"ERROR" => "could not connect to user database - $error"}, 500 );
+ $self->return_data( {"ERROR" => "could not connect to user database - $error"}, 500 );
}
# get data
my $user = $dbmaster->User->get_objects( { "login" => $id } );
unless (scalar(@$user)) {
- $self->return_data( {"ERROR" => "login $id does not exists"}, 404 );
+ $self->return_data( {"ERROR" => "login $id does not exists"}, 404 );
}
# prepare data

0 comments on commit ead4cde

Please sign in to comment.