app/helpers/extensions_helper.rb
#
# Returns a URL for the latest version of the given extension
#
# @param extension [Extension]
#
# @return [String] the URL
#
Returns a URL for the latest version of the given extension
Returns a URL for the latest version of the given extension
def compilation_status(extension, job_ids)
    job_count = @job_ids.length
    pending, retrying, complete, failed = 0.0, 0.0, 0.0, 0.0
    jobs_failed, jobs_retrying = [], []
    @job_ids.each do |job, key|
      status = Sidekiq::Status::status(key)
      case status
        when :queued, :working
          pending += 1
        when :retrying
          retrying += 1
          jobs_retrying << job
        when :complete
          complete += 1
        when :failed, :interrupted
          failed += 1
          jobs_failed << job
        else
      end
    end
    percent_complete = ((complete / job_count) * 100).round(2)
    html = ''
    klass = 'compilation-complete'
    if failed > 0
      html += content_tag("div", raw("<b>Compilations failed:</b> #{jobs_failed.join(', ')}"), class: 'compilation-notice')
      klass = 'compilation-failed'
    end
    if retrying > 0
      html += content_tag("div", raw("<b>Retrying Compilations:</b> #{jobs_retrying.join(', ')}"), class: 'compilation-notice')
       klass = 'compilation-retry'
    end
    html += content_tag('div', raw("<b>Compiling Extension % #{percent_complete} Complete</b>"), class: 'compilation-notice')
    if percent_complete == 100
      redis_pool.with do |redis|
        redis.del("compile.extension;#{extension.id};status")
      end
    end
    content_tag('div', raw(html), class: klass )
  end
def compilation_status ( extension , job_ids ) job_count = @job_ids . length pending , retrying , complete , failed = 0.0 , 0.0 , 0.0 , 0.0 jobs_failed , jobs_retrying = [ ] , [ ] @job_ids . each do | job , key | status = Sidekiq :: Status :: status ( key ) case status when :queued , :working pending += 1 when :retrying retrying += 1 jobs_retrying << job when :complete complete += 1 when :failed , :interrupted failed += 1 jobs_failed << job else end end percent_complete = ( ( complete / job_count ) * 100 ) . round ( 2 ) html = '' klass = 'compilation-complete' if failed > 0 html += content_tag ( "div" , raw ( "<b>Compilations failed:</b> #{jobs_failed.join(', ')}" ) , class : 'compilation-notice' ) klass = 'compilation-failed' end if retrying > 0 html += content_tag ( "div" , raw ( "<b>Retrying Compilations:</b> #{jobs_retrying.join(', ')}" ) , class : 'compilation-notice' ) klass = 'compilation-retry' end html += content_tag ( 'div' , raw ( "<b>Compiling Extension % #{percent_complete} Complete</b>" ) , class : 'compilation-notice' ) if percent_complete == 100 redis_pool . with do | redis | redis . del ( "compile.extension;#{extension.id};status" ) end end content_tag ( 'div' , raw ( html ) , class : klass ) end
Returns a URL for the latest version of the given extension
Returns a URL for the latest version of the given extension
# puts status
None
String
extension
<not_specific>
job_ids
<not_specific>
<not_specific>
None