<commit_before><template>

  <div class="interaction-list">

    <div class="attempt-container">
      <InteractionItem
        v-for="(interaction, index) in interactions"
        :key="index"
        :selected="isSelected(index)"
        :interaction="interaction"
        @click.native="setCurrentInteractionIndex(index)"
      />
    </div>

    <p v-if="interactions.length">
      {{ $tr('currAnswer', {value: selectedInteractionIndex + 1 }) }}
    </p>
    <p v-else>
      {{ $tr('noInteractions') }}
    </p>

  </div>

</template>


<script>

  import responsiveElement from 'kolibri.coreVue.mixins.responsiveElement';
  import InteractionItem from './InteractionItem';

  export default {
    name: 'InteractionList',
    components: { InteractionItem },
    mixins: [responsiveElement],
    $trs: {
      currAnswer: 'Attempt {value, number, integer}',
      noInteractions: 'No attempts made on this question',
    },
    props: {
      interactions: {
        type: Array,
        required: true,
      },
      selectedInteractionIndex: {
        type: Number,
        required: true,
      },
    },
    methods: {
      setCurrentInteractionIndex(index) {
        this.$emit('select', index);
      },
      isSelected(index) {
        return Number(this.selectedInteractionIndex) === index;
      },
    },
  };

</script>


<style lang="scss" scoped>

  .header {
    padding-top: 10px;
    margin-top: 0;
  }

  .attempt-container {
    overflow-x: auto;
    white-space: nowrap;
  }

  .pagination-btn {
    width: 40px;
    height: 40px;
    margin: 10px;
  }

  .pagination-right {
    position: absolute;
    right: 0;
  }

</style>
<commit_msg>In Exercise Details, show “Attempts N” only when 2+ attempts<commit_after><template>

  <div class="interaction-list">

    <div class="attempt-container">
      <InteractionItem
        v-for="(interaction, index) in interactions"
        :key="index"
        :selected="isSelected(index)"
        :interaction="interaction"
        @click.native="setCurrentInteractionIndex(index)"
      />
    </div>

    <p>
      {{ interactionsMessage }}
    </p>

  </div>

</template>


<script>

  import responsiveElement from 'kolibri.coreVue.mixins.responsiveElement';
  import InteractionItem from './InteractionItem';

  export default {
    name: 'InteractionList',
    components: { InteractionItem },
    mixins: [responsiveElement],
    $trs: {
      currAnswer: 'Attempt {value, number, integer}',
      noInteractions: 'No attempts made on this question',
    },
    props: {
      interactions: {
        type: Array,
        required: true,
      },
      selectedInteractionIndex: {
        type: Number,
        required: true,
      },
    },
    computed: {
      interactionsMessage() {
        const numAttempts = this.interactions.length;
        if (numAttempts === 0) {
          return this.$tr('noInteractions');
        }
        if (numAttempts > 1) {
          return this.$tr('currAnswer', { value: this.selectedInteractionIndex + 1 });
        }
        return '';
      },
    },
    methods: {
      setCurrentInteractionIndex(index) {
        this.$emit('select', index);
      },
      isSelected(index) {
        return Number(this.selectedInteractionIndex) === index;
      },
    },
  };

</script>


<style lang="scss" scoped>

  .header {
    padding-top: 10px;
    margin-top: 0;
  }

  .attempt-container {
    overflow-x: auto;
    white-space: nowrap;
  }

  .pagination-btn {
    width: 40px;
    height: 40px;
    margin: 10px;
  }

  .pagination-right {
    position: absolute;
    right: 0;
  }

</style>

{'fraction_non_alphanumeric': 0.13783559368945475, 'fraction_numerical': 0.006919457514530861, 'mean_word_length': 2.361860465116279, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4551481', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1114, 'n_words': 228}