DROP VIEW IF EXISTS translators_rate_view;
CREATE VIEW translators_rate_view(
    totalRateTranslator,
    totalArticleScoringTranslator,
    translator_id
) as
SELECT
        (
            COALESCE(puntuality_rate.rate, 0) + COALESCE(quality_rate.rate, 0)
        ) AS totalRateTranslator,
        COALESCE(
            total_article_scoring_translator_view.total_scoring,
            0
        ) AS totalArticleScoringTranslator,
        userInfo.id AS translator_id
    FROM
        translators_view
    LEFT JOIN user userInfo ON
        translators_view.user_id = userInfo.id
    LEFT JOIN scoring_puntuality_rate_view puntuality_rate ON
        (
            translators_view.user_id = puntuality_rate.user_id
        ) AND(
            puntuality_rate.participant_type = 4
        )
    LEFT JOIN scoring_quality_rate_view quality_rate ON
        (
            translators_view.user_id = quality_rate.user_id
        ) AND(
            quality_rate.participant_type = 4
        )
    LEFT JOIN total_article_scoring_translator_view ON total_article_scoring_translator_view.user_id = userInfo.id
    GROUP BY
        translators_view.id;