You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: pipeline_reconciler_impl.go
    path of file: ./repos/erda/internal/tools/pipeline/providers/reconciler
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Licens
    
func (pr *defaultPipelineReconciler) calculatePipelineStatusForTaskUseField(ctx context.Context, p *spec.Pipeline) apistructs.PipelineStatus {
	// get all reconciled tasks
	var reconciledTasks []*spec.PipelineTask
	pr.processedTasks.Range(func(key, value interface{}) bool {
		t, ok := value.(*spec.PipelineTask)
		if !ok {
			pr.log.Panicf("invalid type of value in processedTasks, key: %v, value: %v, pipelineID: %d",
				key, value, p.ID)
		}
		reconciledTasks = append(reconciledTasks, t)
		return true
	})

	// calculate new pipeline status
	calculatedPipelineStatusByAllReconciledTasks := statusutil.CalculatePipelineStatusV2(reconciledTasks)
	// consider some special cases:
	// - no reconciled tasks but pipeline actually have tasks (to resolve first time of loop)
	// - all tasks are disabled, in this case, total task number gt 0 but no reconciled tasks
	if calculatedPipelineStatusByAllReconciledTasks.IsSuccessStatus() && len(reconciledTasks) == 0 && *pr.totalTaskNumber > 0 {
		calculatedPipelineStatusByAllReconciledTasks = apistructs.PipelineStatusRunning
	}

	// update status
	return calculatedPipelineStatusByAllReconciledTasks
}