DROP VIEW IF EXISTS editors_rate_view;
CREATE VIEW editors_rate_view(
    editorTotalRate,
    editorTotalArticleScoring,
    editor_id
) as
SELECT
        (
            COALESCE(editor_puntuality_rate.rate, 0) + COALESCE(editor_quality_rate.rate, 0)
        ) AS editorTotalRate,
        COALESCE(
            total_article_scoring_editor_view.total_scoring,
            0
        ) AS editorTotalArticleScoring,
        editors_view.id AS editor_id
    FROM
        editors_view
    LEFT JOIN user ON editors_view.user_id = user.id
    LEFT JOIN scoring_puntuality_rate_view editor_puntuality_rate ON
        (
            editors_view.user_id = editor_puntuality_rate.user_id
        ) AND(
            editor_puntuality_rate.participant_type = 2
        )
    LEFT JOIN scoring_quality_rate_view editor_quality_rate ON
        (
            editors_view.user_id = editor_quality_rate.user_id
        ) AND(
            editor_quality_rate.participant_type = 2
        )
    LEFT JOIN total_article_scoring_editor_view ON total_article_scoring_editor_view.user_id = user.id;
