Preview:
  handleChangeScoringSetting = newScoringSetting => {
    const { surveyId, currentSurveyId, consultantId, scoringSetting } = this.state;

    // const matrixWorkshopsRef = firebase
    //   .firestore()
    //   .collection(consultantId ? 'portfolio-surveys-consultants' : 'surveys')
    //   .doc(surveyId ? surveyId : currentSurveyId);

    if (scoringSetting !== newScoringSetting) {
      this.setState({
        scoringSetting: newScoringSetting,
      });

      const body = {
        scoringSettings: newScoringSetting,
      };

      updateConsultantsOrSurveyProperty({
        surveyId,
        consultantId,
        property: "scoringSettings"
      }, body).then((res) => {
        console.log(`Updated scoring setting`, res);
      }).catch((err) => {
        console.log("Error updating scoring setting", err)
      })

      // matrixWorkshopsRef
      //   .update({
      //     scoringSetting: newScoringSetting,
      //   })
      //   .then(() => {
      //     console.log(`Updated scoring setting`);
      //   })
      //   .catch(error => {
      //     console.log('Updated scoring setting');
      //   });
    }
  };
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter