DROP VIEW IF EXISTS offer_translators_view_es;
CREATE VIEW offer_translators_view_es(
    id,
    user_id,
    offer_status,
    participant_type,
    partitipant_name,
    offer_id,
    totalRateTranslator,
    totalArticleScoringTranslator
) as
SELECT
        offer_partitipants.id,
        offer_partitipants.user_id,
        offer_partitipants.offer_status,
        offer_partitipants.participant_type,
        offer_partitipants.partitipant_name,
        offer_partitipants.offer_id,
        translators_rate_view.totalRateTranslator,
        translators_rate_view.totalArticleScoringTranslator
    FROM
        offer_partitipants
    LEFT JOIN project_offers offer ON
        offer_partitipants.offer_id = offer.id
    LEFT JOIN user ON offer_partitipants.user_id = user.id
    LEFT JOIN authors author ON
        user.id = author.user_id
    LEFT JOIN editors editor ON
        user.id = editor.user_id
    LEFT JOIN offer_deliveries offerDeliveries ON
        offer.id = offerDeliveries.offer_id
    LEFT JOIN translators_rate_view ON translators_rate_view.translator_id = user.id
    WHERE participant_type = 4
    GROUP BY
        offer_id,
        user_id;