Przeglądaj źródła

:recycle: refactor data generation | adding blurbs | moving user_media to response

tags/0.0.1
J 4 lat temu
rodzic
commit
d76b72bef7

+ 15
- 6
backend/db/data-generator/config.json Wyświetl plik

@@ -2,22 +2,31 @@
2 2
     "mockOutputPath": "./db/generated",
3 3
     "magic": 10000,
4 4
     "total": 50,
5
-    "batchSize": 10,
6
-    "questions": 7,
5
+    "batchSize": 5,
7 6
     "percentageOfSeekers": 90,
8 7
     "scoreVals": [107, 414, 721, 1028, 1336, 1648, 2056],
9 8
     "header": "/**\n* GENERATED MOCK SIIMEE DATA\n*/",
10 9
     "possibleZipcodes": [
11
-        "90065",
12 10
         "90012",
11
+        "90040",
12
+        "90058",
13
+        "90064",
14
+        "90065",
13 15
         "90240",
16
+        "90274",
17
+        "90278",
18
+        "90280",
19
+        "90290",
20
+        "90291",
21
+        "90292",
22
+        "90293",
23
+        "90840",
24
+        "91001",
25
+        "91011",
14 26
         "91030",
15 27
         "91201",
16 28
         "91399",
17 29
         "91401",
18
-        "90840",
19
-        "91001",
20
-        "91011",
21 30
         "97075"
22 31
     ]
23 32
 }

+ 1
- 1
backend/db/data-generator/generate.ipynb Wyświetl plik

@@ -168,7 +168,7 @@
168 168
    "name": "python",
169 169
    "nbconvert_exporter": "python",
170 170
    "pygments_lexer": "ipython3",
171
-   "version": "3.7.10"
171
+   "version": "3.6.9"
172 172
   },
173 173
   "orig_nbformat": 4
174 174
  },

+ 31
- 27
backend/db/data-generator/index.js Wyświetl plik

@@ -2,7 +2,7 @@ const fs = require('fs')
2 2
 const config = require('./config')
3 3
 const random = require('./random')
4 4
 const classes = require('./classes')
5
-const score = require('./score')
5
+const mock = require('./mock')
6 6
 
7 7
 let batchCount = 1 // Counter to track how many things we've generated
8 8
 let extraProfilesToGenerate = 1
@@ -44,7 +44,6 @@ const write = async (batchNum, outputDataObject) => {
44 44
 }
45 45
 
46 46
 // Helper functions
47
-// const preComputedScores = score.precomputed
48 47
 const generate = (classObj, amount, meta) => {
49 48
     const instances = []
50 49
     for (let i = 0; i < amount; i++) {
@@ -115,23 +114,46 @@ const generateProfiles = jobPosterIds => {
115 114
 /**
116 115
  * Generate Responses
117 116
  */
117
+const _ZIPCODEKEY = 7
118 118
 const generateResponses = profiles => {
119 119
     // Generate responses first, before filling in details
120 120
     let responses = generate(
121 121
         classes.Response,
122
-        (config.batchSize + extraProfilesToGenerate) * config.questions,
122
+        (config.batchSize + extraProfilesToGenerate) * mock.response_keys.length,
123 123
         { starting: generatedResponseCount + config.batchSize },
124 124
     )
125 125
     profiles.forEach((profile, i) => {
126
-        const startingIndex = i * config.questions
127
-        for (let k = 0; k < config.questions; k++) {
126
+        const startingIndex = i * mock.response_keys.length
127
+        for (let k = 0; k < mock.response_keys.length; k++) {
128 128
             const resToEdit = responses[startingIndex + k]
129 129
             resToEdit.response_key_id = k + 1
130 130
             resToEdit.profile_id = profile.profile_id
131
-            resToEdit.val =
132
-                k + 1 == config.questions
133
-                    ? random.valFrom(config.possibleZipcodes)
134
-                    : random.valFrom(Object.values(possibleResponses))
131
+
132
+            if(resToEdit.response_key_id < _ZIPCODEKEY) {
133
+                resToEdit.val = random.valFrom(Object.values(possibleResponses))
134
+            }
135
+            else if(resToEdit.response_key_id == _ZIPCODEKEY) {
136
+                resToEdit.val = random.valFrom(config.possibleZipcodes)
137
+            }
138
+            else {
139
+                switch (resToEdit.response_key_id) {
140
+                    case 8:
141
+                        resToEdit.val = random.media()
142
+                        break
143
+                    case 9:
144
+                        resToEdit.val = random.language()
145
+                        break
146
+                    case 10:
147
+                        resToEdit.val = random.duration()
148
+                        break
149
+                    case 11:
150
+                        resToEdit.val = random.location()
151
+                        break
152
+                    case 12:
153
+                        resToEdit.val = random.blurb()
154
+                        break
155
+                }
156
+            }
135 157
         }
136 158
     })
137 159
     generatedResponseCount = generatedResponseCount + responses.length
@@ -142,11 +164,6 @@ const generateResponses = profiles => {
142 164
 /**
143 165
  * Our main generator loop
144 166
  */
145
-const writeBarrel = async () => {
146
-    await fs.writeFile(`${config.mockOutputPath}/index.js`, '', () => {})
147
-}
148
-// writeBarrel()
149
-
150 167
 for (
151 168
     let batch = config.batchSize;
152 169
     batch <= config.total;
@@ -169,19 +186,6 @@ for (
169 186
     const responses = generateResponses(profiles)
170 187
 
171 188
     write(config.batchSize * batchCount, { users, profiles, responses })
172
-
173
-    /**
174
-     * Write barrel export
175
-     */
176
-    // const filename = `_batch_${config.batchSize * batchCount}.js`
177
-    // fs.appendFile(
178
-    //     `${config.mockOutputPath}/index.js`,
179
-    //     `export * from './${filename}'\n`,
180
-    //     err => {
181
-    //         if (err) console.error(err)
182
-    //     },
183
-    // )
184
-
185 189
     batchCount++
186 190
 }
187 191
 

+ 230
- 0
backend/db/data-generator/lorem.js Wyświetl plik

@@ -0,0 +1,230 @@
1
+/**
2
+ * @fileOverview Generates "Lorem ipsum" style text.
3
+ * @author rviscomi@gmail.com Rick Viscomi,
4
+ * 		tinsley@tinsology.net Mathew Tinsley
5
+ * @version 1.0
6
+ */
7
+
8
+/**
9
+ *	Copyright (c) 2009, Mathew Tinsley (tinsley@tinsology.net)
10
+ *	All rights reserved.
11
+ *
12
+ *	Redistribution and use in source and binary forms, with or without
13
+ *	modification, are permitted provided that the following conditions are met:
14
+ *		* Redistributions of source code must retain the above copyright
15
+ *		  notice, this list of conditions and the following disclaimer.
16
+ *		* Redistributions in binary form must reproduce the above copyright
17
+ *		  notice, this list of conditions and the following disclaimer in the
18
+ *		  documentation and/or other materials provided with the distribution.
19
+ *		* Neither the name of the organization nor the
20
+ *		  names of its contributors may be used to endorse or promote products
21
+ *		  derived from this software without specific prior written permission.
22
+ *
23
+ *	THIS SOFTWARE IS PROVIDED BY MATHEW TINSLEY ''AS IS'' AND ANY
24
+ *	EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25
+ *	WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+ *	DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
27
+ *	DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28
+ *	(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29
+ *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30
+ *	ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
+ *	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
+ *	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+ */
34
+
35
+/**
36
+ * @class Jibborish generator.
37
+ */
38
+var LoremIpsum = function () {};
39
+
40
+/**
41
+ * Average number of words per sentence.
42
+ * @constant {number}
43
+ */
44
+LoremIpsum.WORDS_PER_SENTENCE_AVG = 24.460;
45
+
46
+/**
47
+ * Standard deviation of the number of words per sentence.
48
+ * @constant {number}
49
+ */
50
+LoremIpsum.WORDS_PER_SENTENCE_STD = 5.080;
51
+
52
+/**
53
+ * List of possible words.
54
+ * @constant {Array.string}
55
+ */
56
+LoremIpsum.WORDS = [
57
+		'lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur',
58
+		'adipiscing', 'elit', 'curabitur', 'vel', 'hendrerit', 'libero',
59
+		'eleifend', 'blandit', 'nunc', 'ornare', 'odio', 'ut',
60
+		'orci', 'gravida', 'imperdiet', 'nullam', 'purus', 'lacinia',
61
+		'a', 'pretium', 'quis', 'congue', 'praesent', 'sagittis', 
62
+		'laoreet', 'auctor', 'mauris', 'non', 'velit', 'eros',
63
+		'dictum', 'proin', 'accumsan', 'sapien', 'nec', 'massa',
64
+		'volutpat', 'venenatis', 'sed', 'eu', 'molestie', 'lacus',
65
+		'quisque', 'porttitor', 'ligula', 'dui', 'mollis', 'tempus',
66
+		'at', 'magna', 'vestibulum', 'turpis', 'ac', 'diam',
67
+		'tincidunt', 'id', 'condimentum', 'enim', 'sodales', 'in',
68
+		'hac', 'habitasse', 'platea', 'dictumst', 'aenean', 'neque',
69
+		'fusce', 'augue', 'leo', 'eget', 'semper', 'mattis', 
70
+		'tortor', 'scelerisque', 'nulla', 'interdum', 'tellus', 'malesuada',
71
+		'rhoncus', 'porta', 'sem', 'aliquet', 'et', 'nam',
72
+		'suspendisse', 'potenti', 'vivamus', 'luctus', 'fringilla', 'erat',
73
+		'donec', 'justo', 'vehicula', 'ultricies', 'varius', 'ante',
74
+		'primis', 'faucibus', 'ultrices', 'posuere', 'cubilia', 'curae',
75
+		'etiam', 'cursus', 'aliquam', 'quam', 'dapibus', 'nisl',
76
+		'feugiat', 'egestas', 'class', 'aptent', 'taciti', 'sociosqu',
77
+		'ad', 'litora', 'torquent', 'per', 'conubia', 'nostra',
78
+		'inceptos', 'himenaeos', 'phasellus', 'nibh', 'pulvinar', 'vitae',
79
+		'urna', 'iaculis', 'lobortis', 'nisi', 'viverra', 'arcu',
80
+		'morbi', 'pellentesque', 'metus', 'commodo', 'ut', 'facilisis',
81
+		'felis', 'tristique', 'ullamcorper', 'placerat', 'aenean', 'convallis',
82
+		'sollicitudin', 'integer', 'rutrum', 'duis', 'est', 'etiam',
83
+		'bibendum', 'donec', 'pharetra', 'vulputate', 'maecenas', 'mi',
84
+		'fermentum', 'consequat', 'suscipit', 'aliquam', 'habitant', 'senectus',
85
+		'netus', 'fames', 'quisque', 'euismod', 'curabitur', 'lectus',
86
+		'elementum', 'tempor', 'risus', 'cras'
87
+];
88
+
89
+/**
90
+ * Generate "Lorem ipsum" style words.
91
+ * @param num_words {number} Number of words to generate.
92
+ * @return {string} "Lorem ipsum..."
93
+ */
94
+LoremIpsum.prototype.generate = function (num_words) {
95
+	var words, ii, position, word, current, sentences, sentence_length, sentence;
96
+	
97
+	/**
98
+	 * @default 100
99
+	 */
100
+	num_words = num_words || 100;
101
+	
102
+	words = [LoremIpsum.WORDS[0], LoremIpsum.WORDS[1]];
103
+	num_words -= 2;
104
+	
105
+	for (ii = 0; ii < num_words; ii++) {
106
+		position = Math.floor(Math.random() * LoremIpsum.WORDS.length);
107
+		word = LoremIpsum.WORDS[position];
108
+		
109
+		if (ii > 0 && words[ii - 1] === word) {
110
+			ii -= 1;
111
+			
112
+		} else {
113
+			words[ii] = word;
114
+		}
115
+	}
116
+	
117
+	sentences = [];
118
+	current = 0;
119
+	
120
+	while (num_words > 0) {
121
+		sentence_length = this.getRandomSentenceLength();
122
+		
123
+		if (num_words - sentence_length < 4) {
124
+			sentence_length = num_words;
125
+		}
126
+		
127
+		num_words -= sentence_length;
128
+		
129
+		sentence = [];
130
+		
131
+		for (ii = current; ii < (current + sentence_length); ii++) {
132
+			sentence.push(words[ii]);
133
+		}
134
+		
135
+		sentence = this.punctuate(sentence);
136
+		current += sentence_length;
137
+		sentences.push(sentence.join(' '));
138
+	}
139
+	
140
+	return sentences.join(' ');
141
+};
142
+
143
+/**
144
+ * Insert commas and periods in the given sentence.
145
+ * @param {Array.string} sentence List of words in the sentence.
146
+ * @return {Array.string} Sentence with punctuation added.
147
+ */
148
+LoremIpsum.prototype.punctuate = function (sentence) {
149
+	var word_length, num_commas, ii, position;
150
+	
151
+	word_length = sentence.length;
152
+	
153
+	/* End the sentence with a period. */
154
+	sentence[word_length - 1] += '.';
155
+	
156
+	if (word_length < 4) {
157
+		return sentence;
158
+	}
159
+	
160
+	num_commas = this.getRandomCommaCount(word_length);
161
+	
162
+	for (ii = 0; ii <= num_commas; ii++) {
163
+		position = Math.round(ii * word_length / (num_commas + 1));
164
+		
165
+		if (position < (word_length - 1) && position > 0) {
166
+			/* Add the comma. */
167
+			sentence[position] += ',';
168
+		}
169
+	}
170
+	
171
+	/* Capitalize the first word in the sentence. */
172
+	sentence[0] = sentence[0].charAt(0).toUpperCase() + sentence[0].slice(1);
173
+	
174
+	return sentence;
175
+};
176
+
177
+/**
178
+ * Produces a random number of commas.
179
+ * @param {number} word_length Number of words in the sentence.
180
+ * @return {number} Random number of commas
181
+ */
182
+LoremIpsum.prototype.getRandomCommaCount = function (word_length) {
183
+	var base, average, standard_deviation;
184
+	
185
+	/* Arbitrary. */
186
+	base = 6;
187
+	
188
+	average = Math.log(word_length) / Math.log(base);
189
+	standard_deviation = average / base;
190
+	
191
+	return Math.round(this.gaussMS(average, standard_deviation));
192
+};
193
+
194
+/**
195
+ * Produces a random sentence length based on the average word length
196
+ * of an English sentence.
197
+ * @return {number} Random sentence length
198
+ */
199
+LoremIpsum.prototype.getRandomSentenceLength = function () {
200
+	return Math.round(
201
+			this.gaussMS(
202
+					LoremIpsum.WORDS_PER_SENTENCE_AVG,
203
+					LoremIpsum.WORDS_PER_SENTENCE_STD
204
+			)
205
+	);
206
+};
207
+
208
+/**
209
+ * Produces a random number.
210
+ * @return {number} Random number
211
+ */
212
+LoremIpsum.prototype.gauss = function () {
213
+	return (Math.random() * 2 - 1) +
214
+			(Math.random() * 2 - 1) +
215
+			(Math.random() * 2 - 1);
216
+};
217
+
218
+/**
219
+ * Produces a random number with Gaussian distribution.
220
+ * @param {number} mean
221
+ * @param {number} standard_deviation
222
+ * @return {number} Random number
223
+ */
224
+LoremIpsum.prototype.gaussMS = function (mean, standard_deviation) {
225
+	return Math.round(this.gauss() * standard_deviation + mean);
226
+};
227
+
228
+module.exports = {
229
+	LoremIpsum
230
+}

backend/db/mock.js → backend/db/data-generator/mock.js Wyświetl plik

@@ -8,29 +8,39 @@ module.exports = {
8 8
             tag_description: 'verified',
9 9
             is_active: true,
10 10
         },
11
+        {
12
+            tag_id: 2,
13
+            tag_category: 'reveal',
14
+            tag_description: 'verified',
15
+            is_active: true,
16
+        },
11 17
     ],
12 18
     tag_associations: [
13 19
         {
14 20
             tag_association_id: 1,
15 21
             profile_id: 1,
22
+            membership_id: null,
16 23
             tag_id: 1,
17 24
             is_deleted: false,
18 25
         },
19 26
         {
20 27
             tag_association_id: 2,
21 28
             profile_id: 2,
29
+            membership_id: null,
22 30
             tag_id: 1,
23 31
             is_deleted: false,
24 32
         },
25 33
         {
26 34
             tag_association_id: 3,
27 35
             profile_id: 3,
36
+            membership_id: null,
28 37
             tag_id: 1,
29 38
             is_deleted: false,
30 39
         },
31 40
         {
32 41
             tag_association_id: 4,
33 42
             profile_id: 5,
43
+            membership_id: null,
34 44
             tag_id: 1,
35 45
             is_deleted: false,
36 46
         },
@@ -79,10 +89,59 @@ module.exports = {
79 89
             response_key_prompt: 'what is your zip code',
80 90
             response_key_description: null,
81 91
         },
92
+        {
93
+            response_key_id: 8,
94
+            response_key_category: 'profile',
95
+            response_key_prompt: 'image',
96
+            response_key_description: null,
97
+        },
98
+        {
99
+            response_key_id: 9,
100
+            response_key_category: 'profile',
101
+            response_key_prompt: 'language',
102
+            response_key_description: null,
103
+        },
104
+        {
105
+            response_key_id: 10,
106
+            response_key_category: 'profile',
107
+            response_key_prompt: 'distance',
108
+            response_key_description: null,
109
+        },
110
+        {
111
+            response_key_id: 11,
112
+            response_key_category: 'profile',
113
+            response_key_prompt: 'duration',
114
+            response_key_description: null,
115
+        },
116
+        {
117
+            response_key_id: 12,
118
+            response_key_category: 'profile',
119
+            response_key_prompt: 'blurb',
120
+            response_key_description: null,
121
+        },
82 122
     ],
83 123
     responses: [],
84 124
     memberships: [],
85 125
     groupings: [],
86 126
     messages: [],
87
-    match_queues: [],
127
+    match_queues: [
128
+        {
129
+            match_queue_id: 1,
130
+            profile_id: 45,
131
+            target_id: 1,
132
+            is_deleted: false,
133
+        },
134
+        {
135
+            match_queue_id: 2,
136
+            profile_id: 45,
137
+            target_id: 2,
138
+            is_deleted: false,
139
+        },
140
+        {
141
+            match_queue_id: 3,
142
+            profile_id: 45,
143
+            target_id: 3,
144
+            is_deleted: false,
145
+        }
146
+    ],
88 147
 }

+ 46
- 1
backend/db/data-generator/random.js Wyświetl plik

@@ -1,3 +1,5 @@
1
+const lipsum = require('./lorem')
2
+
1 3
 const randomNumber = max => {
2 4
     return Math.floor(Math.random() * max) < 1
3 5
         ? 1
@@ -45,10 +47,53 @@ const randomMedia = () => {
45 47
     return randomValFrom(stockimg)
46 48
 }
47 49
 
50
+const randomLang = () => {
51
+    const langs = [
52
+        'javascript',
53
+        'python',
54
+        'ruby',
55
+        'erlang',
56
+        'haskall',
57
+        'php',
58
+        'swift',
59
+        'rust',
60
+        'objective-c',
61
+        'common lisp',
62
+        'java',
63
+        'perl',
64
+        'cobol',
65
+        'fortran',
66
+        'julia',
67
+        'c#',
68
+        'go',
69
+        'c++',
70
+    ]
71
+    return randomValFrom(langs)
72
+}
73
+
74
+const randomDuration = () => {
75
+    const duration = ['full', 'part']
76
+    return randomValFrom(duration)
77
+}
78
+
79
+const randomLocation = () => {
80
+    const location = ['onsite', 'remote', 'flexible']
81
+    return randomValFrom(location)
82
+}
83
+
84
+const randomBlurb = () => {
85
+    const l = new lipsum.LoremIpsum()
86
+    return l.generate(randomNumber(50))
87
+}
88
+
48 89
 module.exports = {
49 90
     number: randomNumber,
50 91
     valFrom: randomValFrom,
51 92
     email: randomEmail,
52 93
     name: randomName,
53
-    media: randomMedia
94
+    media: randomMedia,
95
+    language: randomLang,
96
+    duration: randomDuration,
97
+    location: randomLocation,
98
+    blurb: randomBlurb
54 99
 }

+ 0
- 75
backend/db/data-generator/score.js Wyświetl plik

@@ -1,75 +0,0 @@
1
-const cosineSimilarity = require('compute-cosine-similarity')
2
-
3
-const config = require('./config')
4
-
5
-const preComputedScores = {
6
-    100: {
7
-        100: 1000,
8
-        140: 872,
9
-        180: 675,
10
-        220: 518,
11
-        260: 406,
12
-        400: 215,
13
-    },
14
-    140: {
15
-        100: 872,
16
-        140: 1000,
17
-        180: 938,
18
-        220: 828,
19
-        260: 723,
20
-        400: 486,
21
-    },
22
-    180: {
23
-        100: 675,
24
-        140: 938,
25
-        180: 1000,
26
-        220: 968,
27
-        260: 906,
28
-        400: 706,
29
-    },
30
-    220: {
31
-        100: 518,
32
-        140: 828,
33
-        180: 968,
34
-        220: 1000,
35
-        260: 982,
36
-        400: 847,
37
-    },
38
-    260: {
39
-        100: 406,
40
-        140: 723,
41
-        180: 906,
42
-        220: 982,
43
-        260: 1000,
44
-        400: 928,
45
-    },
46
-    400: {
47
-        100: 215,
48
-        140: 486,
49
-        180: 706,
50
-        220: 847,
51
-        260: 928,
52
-        400: 1000,
53
-    },
54
-}
55
-const score2d = (a, b) => {
56
-    const aScorePlusBase = [100]
57
-    const bScorePlusBase = [100]
58
-    aScorePlusBase.push(a)
59
-    bScorePlusBase.push(b)
60
-    return Math.round(
61
-        Math.pow(cosineSimilarity(aScorePlusBase, bScorePlusBase), 10) *
62
-            config.magic,
63
-    )
64
-}
65
-
66
-// Uncomment to rerun precompute
67
-// config.scoreVals.forEach(val => {
68
-//     config.scoreVals.forEach(v => {
69
-//         preComputedScores[val][v] = score2d(val, v)
70
-//     })
71
-// })
72
-
73
-module.exports = {
74
-    precomputed: preComputedScores,
75
-}

+ 1
- 1
backend/db/migrations/20210527174422_create_responses_table.js Wyświetl plik

@@ -3,7 +3,7 @@ exports.up = function (knex) {
3 3
         table.increments('response_id').primary()
4 4
         table.integer('profile_id').notNullable()
5 5
         table.integer('response_key_id').notNullable()
6
-        table.string('val').notNullable()
6
+        table.specificType('val', 'VARCHAR(1000)')
7 7
     })
8 8
 }
9 9
 

+ 1
- 0
backend/db/migrations/20220403111037_create_tag_associations_table.js Wyświetl plik

@@ -2,6 +2,7 @@ exports.up = function (knex) {
2 2
     return knex.schema.createTable('tag_associations', function (table) {
3 3
         table.increments('tag_association_id').primary()
4 4
         table.integer('profile_id').notNullable()
5
+        table.integer('membership_id')
5 6
         table.integer('tag_id').notNullable()
6 7
         table.boolean('is_deleted').notNullable()
7 8
     })

+ 1
- 1
backend/db/seeds/01-users.js Wyświetl plik

@@ -1,4 +1,4 @@
1
-const mock = require('../mock')
1
+const mock = require('../data-generator/mock')
2 2
 const fs = require('fs')
3 3
 
4 4
 let users = []

+ 1
- 1
backend/db/seeds/02-profiles.js Wyświetl plik

@@ -1,4 +1,4 @@
1
-const mock = require('../mock')
1
+const mock = require('../data-generator/mock')
2 2
 const fs = require('fs')
3 3
 
4 4
 let profiles = []

+ 1
- 1
backend/db/seeds/03-response_keys.js Wyświetl plik

@@ -1,4 +1,4 @@
1
-const mock = require('../mock')
1
+const mock = require('../data-generator/mock')
2 2
 const fs = require('fs')
3 3
 
4 4
 let response_keys = []

+ 1
- 1
backend/db/seeds/04-responses.js Wyświetl plik

@@ -1,4 +1,4 @@
1
-const mock = require('../mock')
1
+const mock = require('../data-generator/mock')
2 2
 const fs = require('fs')
3 3
 
4 4
 let responses = []

+ 1
- 1
backend/db/seeds/05-memberships.js Wyświetl plik

@@ -1,4 +1,4 @@
1
-const mock = require('../mock')
1
+const mock = require('../data-generator/mock')
2 2
 
3 3
 exports.seed = function (knex) {
4 4
     // Deletes ALL existing entries

+ 1
- 1
backend/db/seeds/06-groupings.js Wyświetl plik

@@ -1,4 +1,4 @@
1
-const mock = require('../mock')
1
+const mock = require('../data-generator/mock')
2 2
 
3 3
 exports.seed = function (knex) {
4 4
     // Deletes ALL existing entries

+ 1
- 1
backend/db/seeds/07-messages.js Wyświetl plik

@@ -1,4 +1,4 @@
1
-const mock = require('../mock')
1
+const mock = require('../data-generator/mock')
2 2
 
3 3
 exports.seed = function (knex) {
4 4
     // Deletes ALL existing entries

+ 1
- 1
backend/db/seeds/09-match_queues.js Wyświetl plik

@@ -1,4 +1,4 @@
1
-const mock = require('../mock')
1
+const mock = require('../data-generator/mock')
2 2
 exports.seed = function (knex) {
3 3
     // Deletes ALL existing entries
4 4
     return knex('match_queues')

+ 1
- 1
backend/db/seeds/12-tags.js Wyświetl plik

@@ -1,4 +1,4 @@
1
-const mock = require('../mock')
1
+const mock = require('../data-generator/mock')
2 2
 
3 3
 exports.seed = function (knex) {
4 4
     // Deletes ALL existing entries

+ 1
- 1
backend/db/seeds/13-tag_associations.js Wyświetl plik

@@ -1,4 +1,4 @@
1
-const mock = require('../mock')
1
+const mock = require('../data-generator/mock')
2 2
 
3 3
 exports.seed = function (knex) {
4 4
     // Deletes ALL existing entries

+ 3
- 13
frontend/src/utils/login.js Wyświetl plik

@@ -7,28 +7,18 @@ class Login {
7 7
         this.queue = null
8 8
         this.matches = null
9 9
     }
10
-    hasSurvey() {
11
-        return this.survey.length ? true : false 
12
-    }
13
-    hasQueue() {
14
-        return this.queue.length ? true : false 
15
-    }
16
-    hasMatches() {
17
-        return this.matches.length ? true : false 
18
-    }
19 10
 
20 11
     _setSurvey(survey) {
21 12
         this.survey = []
22 13
     }
23 14
 
24 15
     async getQueue() {
16
+        this.queue = null
25 17
         try {
26 18
             const queueList = await fetchQueueByProfileId(this.currentProfileId)
27 19
             const formatted = this._reformatProfiles(queueList)
28
-            this._setQueue(formatted)
20
+            this._SET_QUEUE(formatted)
29 21
         } catch (err) {
30
-            console.error('---')
31
-            this.queue = null
32 22
             console.error(err)
33 23
         }
34 24
     }
@@ -42,7 +32,7 @@ class Login {
42 32
         })
43 33
         return formattedList
44 34
     }
45
-    _setQueue(queue) {
35
+    _SET_QUEUE(queue) {
46 36
         this.queue = queue
47 37
     }
48 38
 

Ładowanie…
Anuluj
Zapisz