mawsitsit 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/ext/mawsitsit/src/parser/manipulators.rs +29 -9
- data/lib/mawsitsit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 867a21589845a2651d16c5c86908df9f874cbc57e7ddd473ced0ac31c9fb94f6
|
|
4
|
+
data.tar.gz: ed926d39b4e8f5be4f7aa97438647ea6c5133ebb836ad94cdc44f8f7eef4bfa4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f6b41088df4958a5455c001666ba612682d4d34a2cd357215e1236ff0ed9b79543db611b324b159601508e39c27917f8d21376df58c10da7c5aa561c8e6a86e5
|
|
7
|
+
data.tar.gz: e4e55eeddbf84e319d8719871e42c0322680dce69a93c85c7f88c1f3c41492238c9e6186482266d4e588bc4bcbb03bff97bd4487299697dd45df650aeee884e3
|
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@ use serde_json::{Map, Value, json};
|
|
|
3
3
|
use std::collections::HashMap;
|
|
4
4
|
use serde_json::Value::Null;
|
|
5
5
|
use crate::parser::parser::JsonValue;
|
|
6
|
-
use super::utils::application_option::{parse_ashby_type, parse_lever_type};
|
|
6
|
+
use super::utils::application_option::{parse_ashby_type, parse_lever_type, QuestionType};
|
|
7
7
|
use chrono::{DateTime, NaiveDateTime, SecondsFormat, Utc};
|
|
8
8
|
|
|
9
9
|
pub enum EnumValue {
|
|
@@ -140,9 +140,12 @@ pub fn like_lever(_args: &Value) -> Value {
|
|
|
140
140
|
if let Some(Value::Array(arr)) = map.get("customQuestions") {
|
|
141
141
|
for value in arr {
|
|
142
142
|
if let Value::Object(map) = value {
|
|
143
|
+
let id = map.get("id").and_then(Value::as_str).unwrap_or("Unknown id");
|
|
143
144
|
if let Some(Value::Array(fields)) = map.get("fields") {
|
|
145
|
+
let mut num = 0;
|
|
144
146
|
for field in fields {
|
|
145
|
-
process_field(field, &mut new_appl);
|
|
147
|
+
process_field(field, &mut new_appl, "customQuestions", Some(id),Some(num), None);
|
|
148
|
+
num += 1;
|
|
146
149
|
}
|
|
147
150
|
}
|
|
148
151
|
}
|
|
@@ -152,7 +155,7 @@ pub fn like_lever(_args: &Value) -> Value {
|
|
|
152
155
|
if let Some(Value::Array(arr)) = map.get("personalInformation") {
|
|
153
156
|
for value in arr {
|
|
154
157
|
if let Value::Object(_) = value {
|
|
155
|
-
process_field(value, &mut new_appl);
|
|
158
|
+
process_field(value, &mut new_appl, "personalInformation", None, None, None);
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
}
|
|
@@ -160,7 +163,7 @@ pub fn like_lever(_args: &Value) -> Value {
|
|
|
160
163
|
if let Some(Value::Array(arr)) = map.get("urls") {
|
|
161
164
|
for value in arr {
|
|
162
165
|
if let Value::Object(_) = value {
|
|
163
|
-
process_field(value, &mut new_appl);
|
|
166
|
+
process_field(value, &mut new_appl, "urls", None, None, Some(QuestionType::Link));
|
|
164
167
|
}
|
|
165
168
|
}
|
|
166
169
|
}
|
|
@@ -177,21 +180,37 @@ pub fn like_lever(_args: &Value) -> Value {
|
|
|
177
180
|
serde_json::Value::Array(new_appl)
|
|
178
181
|
}
|
|
179
182
|
|
|
180
|
-
fn process_field(value: &Value, new_appl: &mut Vec<serde_json::Value>) {
|
|
183
|
+
fn process_field(value: &Value, new_appl: &mut Vec<serde_json::Value>, ext_prefix: &str, ext: Option<&str>, ext_suffix: Option<u32>, force_type: Option<QuestionType>) {
|
|
181
184
|
let question = value.get("text").and_then(Value::as_str).unwrap_or("Unknown question");
|
|
182
185
|
let question_type = value.get("type").and_then(Value::as_str).unwrap_or("Unknown type");
|
|
183
|
-
let ext_id
|
|
186
|
+
let ext_id :String;
|
|
187
|
+
if let Some(ext) = ext {
|
|
188
|
+
ext_id = if let Some(suffix) = ext_suffix {
|
|
189
|
+
format!("lever__{}__{}__{}",ext_prefix, ext, suffix)
|
|
190
|
+
} else {
|
|
191
|
+
format!("lever__{}__{}",ext_prefix, ext)
|
|
192
|
+
};
|
|
193
|
+
} else {
|
|
194
|
+
ext_id = value.get("id").or_else(|| value.get("name"))
|
|
184
195
|
.and_then(Value::as_str)
|
|
185
|
-
.map(|s|
|
|
196
|
+
.map(|s| {
|
|
197
|
+
if let Some(suffix) = ext_suffix {
|
|
198
|
+
format!("lever__{}__{}__{}",ext_prefix, s, suffix)
|
|
199
|
+
} else {
|
|
200
|
+
format!("lever__{}__{}",ext_prefix, s)
|
|
201
|
+
}
|
|
202
|
+
})
|
|
186
203
|
.unwrap_or("Unknown question".to_string());
|
|
204
|
+
}
|
|
205
|
+
|
|
187
206
|
let required = value.get("required").and_then(Value::as_bool).unwrap_or(false);
|
|
188
207
|
let answer_options = value.get("options").and_then(Value::as_array).map(|array| {
|
|
189
208
|
array.iter().filter_map(|item| item.get("text").and_then(Value::as_str)).map(|s| s.to_string()).collect()
|
|
190
209
|
});
|
|
191
|
-
|
|
210
|
+
let question_type_to_use = force_type.unwrap_or_else(|| parse_lever_type(question_type).unwrap());
|
|
192
211
|
let app_option = ApplicationOption::new(
|
|
193
212
|
question.to_string(),
|
|
194
|
-
|
|
213
|
+
question_type_to_use,
|
|
195
214
|
Some(ext_id),
|
|
196
215
|
answer_options,
|
|
197
216
|
required,
|
|
@@ -200,6 +219,7 @@ fn process_field(value: &Value, new_appl: &mut Vec<serde_json::Value>) {
|
|
|
200
219
|
new_appl.push(app_option.to_json());
|
|
201
220
|
}
|
|
202
221
|
|
|
222
|
+
|
|
203
223
|
fn process_eeo(map: &serde_json::Map<String, Value>, key: &str, new_appl: &mut Vec<serde_json::Value>) {
|
|
204
224
|
let question = map.get("text").and_then(Value::as_str).unwrap_or("Unknown question");
|
|
205
225
|
let question_type = map.get("type").and_then(Value::as_str).unwrap_or("Unknown type");
|
data/lib/mawsitsit/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mawsitsit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jan Hummel
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-07-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|