Skip to content

Commit cb8fedc

Browse files
committed
Reduce the size of the unique id to 3B for questions element
1 parent 2ff3fb1 commit cb8fedc

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

β€Ždocs/ballot_encoding.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The answers to questions are encoded in the following way, with one question per
1313
1414
TYPE = "select"|"text"|"rank"
1515
SEP = ":"
16-
ID = up to 3 bytes, encoded in base64
16+
ID = 3 bytes, encoded in base64
1717
ANSWERS = <answer>[","<answer>]*
1818
ANSWER = <select_answer>|<text_answer>|<rank_answer>
1919
SELECT_ANSWER = "0"|"1"

β€Žweb/frontend/src/mocks/mockData.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ const mockElection3: any = {
181181
{
182182
ID: '3cVHIxpx',
183183
Title: 'Choose your lunch',
184-
Order: ['PGPhhJlJ'],
184+
Order: ['PGP'],
185185
Ranks: [],
186186
Selects: [],
187187
Texts: [
188188
{
189-
ID: 'PGPhhJlJ',
189+
ID: 'PGP',
190190
Title: 'Select what you want',
191191
MaxN: 4,
192192
MinN: 0,
@@ -250,7 +250,7 @@ const mockElectionResult31: Results = {
250250
SelectResult: [],
251251
RankResultIDs: [],
252252
RankResult: [],
253-
TextResultIDs: ['PGPhhJlJ'],
253+
TextResultIDs: ['PGP'],
254254
TextResult: [['Alice', 'Pizza', 'Ice cold water', 'πŸ’πŸ’πŸ’πŸ’']],
255255
};
256256

@@ -259,7 +259,7 @@ const mockElectionResult32: Results = {
259259
SelectResult: [],
260260
RankResultIDs: [],
261261
RankResult: [],
262-
TextResultIDs: ['PGPhhJlJ'],
262+
TextResultIDs: ['PGP'],
263263
TextResult: [['Bob', 'Pizza', 'Coke', 'πŸ’πŸ’πŸ’']],
264264
};
265265

β€Žweb/frontend/src/types/getObjectType.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import ShortUniqueId from 'short-unique-id';
22
import * as types from './configuration';
33
import { ID, RANK, SELECT, SUBJECT, TEXT } from './configuration';
44

5-
const uid: Function = new ShortUniqueId({ length: 8 });
5+
const uid: Function = new ShortUniqueId({ length: 3 });
66

77
const emptyConfiguration = (): types.Configuration => {
88
return { MainTitle: '', Scaffold: [] };

0 commit comments

Comments
Β (0)