Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6485 | Rev 6487 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 6485 Rev 6486
Línea 139... Línea 139...
139
  function addZero(unit) {
139
  function addZero(unit) {
140
    return String(unit).padStart(2, '0')
140
    return String(unit).padStart(2, '0')
141
  }
141
  }
Línea 142... Línea 142...
142
 
142
 
143
  function getPorcentage(n, total) {
-
 
144
    console.log(n, total)
143
  function getPorcentage(n, total) {
145
    return (n / total) * 100
144
    return (n / total) * 100
Línea 146... Línea 145...
146
  }
145
  }
147
 
146
 
Línea 196... Línea 195...
196
      {answers.map(
195
      {answers.map(
197
        (option, index) =>
196
        (option, index) =>
198
          option && (
197
          option && (
199
            <RadioButton
198
            <RadioButton
200
              disabled={!isActive}
199
              disabled={!isActive}
-
 
200
              porcentage={
201
              porcentage={votes && getPorcentage(votes[index], voteRef.current)}
201
                voteRef.current && getPorcentage(votes[index], voteRef.current)
-
 
202
              }
202
              key={index}
203
              key={index}
203
            >
204
            >
204
              <input
205
              <input
205
                type="radio"
206
                type="radio"
206
                name="vote"
207
                name="vote"
Línea 208... Línea 209...
208
                disabled={!isActive}
209
                disabled={!isActive}
209
                ref={register({ required: true })}
210
                ref={register({ required: true })}
210
                value={index + 1}
211
                value={index + 1}
211
              />
212
              />
212
              <label htmlFor={`vote-${index + 1}`}>{option}</label>
213
              <label htmlFor={`vote-${index + 1}`}>{option}</label>
213
              {votes && (
214
              {voteRef.current && (
214
                <span className="mb-0">
215
                <span className="mb-0">
215
                  {getPorcentage(votes[index], voteRef.current)}%
216
                  {getPorcentage(votes[index], voteRef.current)}%
216
                </span>
217
                </span>
217
              )}
218
              )}
218
            </RadioButton>
219
            </RadioButton>