DROP VIEW IF EXISTS revisers_rate_view;
CREATE VIEW revisers_rate_view(
    totalRateReviser,
    reviserTotalArticleScoring,
    reviser_id
) as
SELECT
        (
            COALESCE(puntuality_rate.rate, 0) + COALESCE(quality_rate.rate, 0)
        ) AS totalRateReviser,
        COALESCE(
            total_article_scoring_reviser_view.total_scoring,
            0
        ) AS reviserTotalArticleScoring,
        user.id AS reviser_id
    FROM
        user
    LEFT JOIN scoring_puntuality_rate_view puntuality_rate ON
        (
            user.id = puntuality_rate.user_id
        ) AND(
            puntuality_rate.participant_type = 6
        )
    LEFT JOIN scoring_quality_rate_view quality_rate ON
        (user.id = quality_rate.user_id) AND(
            quality_rate.participant_type = 6
        )
    LEFT JOIN total_article_scoring_reviser_view ON total_article_scoring_reviser_view.user_id = user.id
    GROUP BY
        user.id  
ORDER BY reviserTotalArticleScoring  DESC;