Skip to main content
Skip table of contents

Visual progress of sub-tasks

Return a visual bar depending on each sub-task status.

Configuration

Create a Custom smart text field and use the General parsing mode.

Expression

CODE
// Access the list of subtasks associated with the current issue.
let subtasks = issue.subtasks|| [];
if (subtasks.length == 0){
    'No sub-tasks'
  }
  else
  {
    // Filter the subtasks to find only those in a 'Done' status category.
    // This is the primary correction: 's.status.name' is the correct property path.
    let doneSubtasks = subtasks.filter(s => s.status.name == "Done");

    // Calculate the completion percentage and round it to the nearest whole number.
    let value = (doneSubtasks.length / subtasks.length) * 100;
    let percent =  value - value % 1 + (value % 1 >= 0.5 ? 1 : 0) ;

    // --- Progress Bar Rendering Logic ---

    // Define the total width of the progress bar in characters.
    let totalBlocks = 10;

    // Calculate the number of blocks to be filled based on the percentage.
    let filled = (percent / 100) * totalBlocks;

     // Round to the nearest whole block.
  	let full = filled - filled % 1 + (filled % 1 >= 0.5 ? 1 : 0);

    // Construct the progress bar string with emojis.
  let bar = '🟩'.repeat(full) + '⬜️'.repeat(totalBlocks - full);

  `${bar} ${percent}%`
 }

Please, replace the status names as well as the completion emojis with the ones of your choice.

image-20250916-111654.png

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.