Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions BrainPortal/app/models/portal_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,58 +301,6 @@ def unpresetable_params_attributes
{}
end

#######################################################
# Task View API
#######################################################

# This method is used to display a progress bar in the task view
# interface. It returns a hash with the following content:
# * :color: a string containing the color to use in the progress bar.
# * :progress: an int between 0 and 100 that represents the progression percentage.
# * :message: a string that contains an information message.
# * :show_percentage: a boolean that indicates if the percentage has to be shown.
# Examples of returned hashes:
# {
# :color=>"blue",
# :progress => 27,
# :message => "Everything looks good",
# :show_percentage => true
# }
# {
# :color => "rgb(12,44,255)",
# :progress => 42,
# :message => "Oh no your data is corrupted",
# :show_percentage => false
# }
#
# This is a default implementation where the bar progresses based on
# the task status. Tasks may override it to show some task-specific
# progression. It is recommended to keep the following color
# convention: red is for failed tasks, blue for active ones, green
# for completed ones.
def progress_info
progress=15
color="blue"
if CbrainTask::RUNNING_STATUS.include?(self.status)
progress=15*(1+CbrainTask::RUNNING_STATUS.index(self.status))
end
if CbrainTask::COMPLETED_STATUS.include?(self.status)
color="green"
progress=100
end
if CbrainTask::FAILED_STATUS.include?(self.status)
color="red"
progress=100
end
return {:color => color, :progress => progress, :message => nil, :show_percentage => false }
end

# Returns true if progress bar has to be shown. Task must override this method
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is insufficient. Please review the subsystem carefully, you are currently leaving other dead code in the code base. It's not enough just to remove lines, you need to understand how these lines are integrated with the rest of the codebase.

# when the progress bar has to be shown.
def show_progress_bar?
false
end

######################################################
# Task properties directives
######################################################
Expand Down
20 changes: 0 additions & 20 deletions BrainPortal/app/views/tasks/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,6 @@

<% title(@task.name + ' Task Information') %>

<!-- PROGRESS BAR -->
<% if @task.show_progress_bar? %>
<% progress_info = @task.progress_info %>
<strong>Progress</strong>
<% if progress_info[:message].present? || progress_info[:show_percentage] %>
:
<% end %>
<% if progress_info[:show_percentage] %>
<%= progress_info[:percentage].to_i %>%
<% end %>
<%= progress_info[:message] %>
<div id="container" style="width: 40%; height: 2em; border: 1px solid black;">
<div id="progress-bar" style="width: <%= progress_info[:percentage] %>%;
background-color: <%= progress_info[:color] %>;
height: 2em">
<br>
</div>
</div>
<% end %>

<div class="menu_bar">

<% if @task.bourreau&.online? %>
Expand Down
Loading