mirror of
https://github.com/olehomelchenko/Mini-VLAT-ua.git
synced 2025-12-21 21:22:22 +00:00
recording ip
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
{"session_id": "xGc_iJ_5RI-B0PRBROEN-w", "responses": {}, "mini_responses": {"What distance have customers traveled in the taxi the most?": {"response": "30 - 40 Km", "truth": 1, "time": 0.488}, "In 2020, the unemployment rate for Washington (WA) was higher than that of Wisconsin (WI).": {"response": "True", "truth": 0, "time": 0.155}, "Which country has the lowest proportion of Gold medals?": {"response": "U.S.A.", "truth": 0, "time": 0.199}, "What is the approximate global smartphone market share of Samsung?": {"response": "25.3%", "truth": 0, "time": 0.21}, "What was the price of a barrel of oil in February 2020?": {"response": "$47.02", "truth": 0, "time": 0.18}, "What was the ratio of girls named 'Isla' to girls named 'Amelia' in 2012 in the UK?": {"response": "1 to 2", "truth": 1, "time": 0.178}, "What is the cost of peanuts in Seoul?": {"response": "$5.2", "truth": 0, "time": 0.151}, "Which city's metro system has the largest number of stations?": {"response": "Shanghai", "truth": 1, "time": 0.146}, "There is a negative linear relationship between the height and the weight of the 85 males.": {"response": "True", "truth": 1, "time": 0.133}, "eBay is nested in the Software category.": {"response": "True", "truth": 1, "time": 0.089}, "What is the average internet speed in Japan?": {"response": "40.51 Mbps", "truth": 1, "time": 0.125}, "What was the average price of pount of coffee beans in October 2019?": {"response": "$0.90", "truth": 0, "time": 0.491}}, "score": 0, "mini_score": 5, "device": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36", "demographic_responses": {"sex": "male", "age": "21", "education": "associate", "familiarity": "somewhat", "color-blind": "no"}, "comment": "", "height": 870, "width": 1512}
|
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
"@testing-library/jest-dom": "^5.11.4",
|
"@testing-library/jest-dom": "^5.11.4",
|
||||||
"@testing-library/react": "^11.1.0",
|
"@testing-library/react": "^11.1.0",
|
||||||
"@testing-library/user-event": "^12.1.10",
|
"@testing-library/user-event": "^12.1.10",
|
||||||
|
"axios": "^1.3.4",
|
||||||
"bootstrap": "^5.1.3",
|
"bootstrap": "^5.1.3",
|
||||||
"d3": "^7.1.1",
|
"d3": "^7.1.1",
|
||||||
"pdf-viewer-reactjs": "^2.2.3",
|
"pdf-viewer-reactjs": "^2.2.3",
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import StackedBarChartMini from "../components/stacked100bar-mini";
|
|||||||
import StackedAreaPlotMini from "../components/stackedArea-mini";
|
import StackedAreaPlotMini from "../components/stackedArea-mini";
|
||||||
import StackedBarChart2Mini from "../components/stackedbar-mini";
|
import StackedBarChart2Mini from "../components/stackedbar-mini";
|
||||||
import TreeMapMini from "../components/treeMap-mini";
|
import TreeMapMini from "../components/treeMap-mini";
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
import img1 from '../components/data/VLAT-Pics/Scatterplot.png'
|
import img1 from '../components/data/VLAT-Pics/Scatterplot.png'
|
||||||
import img2 from '../components/data/VLAT-Pics/StackedBar.png'
|
import img2 from '../components/data/VLAT-Pics/StackedBar.png'
|
||||||
@@ -84,6 +85,7 @@ class VisQuiz extends Component {
|
|||||||
width: 0,
|
width: 0,
|
||||||
height: 0,
|
height: 0,
|
||||||
mini_score: 0,
|
mini_score: 0,
|
||||||
|
ip_address: "",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -116,8 +118,17 @@ class VisQuiz extends Component {
|
|||||||
|
|
||||||
this.setState({ demographic_questions: new_dq, demographics_incomplete: incomplete })
|
this.setState({ demographic_questions: new_dq, demographics_incomplete: incomplete })
|
||||||
}
|
}
|
||||||
|
getData = async () => {
|
||||||
|
//https://medium.com/how-to-react/how-to-get-user-ip-address-in-react-js-73eb295720d0
|
||||||
|
const res = await axios.get('https://geolocation-db.com/json/')
|
||||||
|
console.log("IP Address: ", res.data);
|
||||||
|
this.setState({
|
||||||
|
ip_address: res.data.IPv4
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
clicked_mini_answer(type, question, response, truth, time) {
|
clicked_mini_answer(type, question, response, truth, time) {
|
||||||
|
this.getData()
|
||||||
if (response === minivis[this.state.current_mini_index]['options'][truth]) {
|
if (response === minivis[this.state.current_mini_index]['options'][truth]) {
|
||||||
this.state.mini_score = this.state.mini_score + 1
|
this.state.mini_score = this.state.mini_score + 1
|
||||||
}
|
}
|
||||||
@@ -177,7 +188,8 @@ class VisQuiz extends Component {
|
|||||||
demographic_responses: this.state.demographic_questions,
|
demographic_responses: this.state.demographic_questions,
|
||||||
comment: this.state.comment,
|
comment: this.state.comment,
|
||||||
height: window.innerHeight,
|
height: window.innerHeight,
|
||||||
width: window.innerWidth
|
width: window.innerWidth,
|
||||||
|
ipaddress: this.state.ip_address
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(res => res.json()).then(data => {
|
.then(res => res.json()).then(data => {
|
||||||
|
|||||||
@@ -3124,6 +3124,15 @@ axe-core@^4.3.5:
|
|||||||
resolved "https://registry.npmjs.org/axe-core/-/axe-core-4.3.5.tgz"
|
resolved "https://registry.npmjs.org/axe-core/-/axe-core-4.3.5.tgz"
|
||||||
integrity sha512-WKTW1+xAzhMS5dJsxWkliixlO/PqC4VhmO9T4juNYcaTg9jzWiJsou6m5pxWYGfigWbwzJWeFY6z47a+4neRXA==
|
integrity sha512-WKTW1+xAzhMS5dJsxWkliixlO/PqC4VhmO9T4juNYcaTg9jzWiJsou6m5pxWYGfigWbwzJWeFY6z47a+4neRXA==
|
||||||
|
|
||||||
|
axios@^1.3.4:
|
||||||
|
version "1.3.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/axios/-/axios-1.3.4.tgz#f5760cefd9cfb51fd2481acf88c05f67c4523024"
|
||||||
|
integrity sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==
|
||||||
|
dependencies:
|
||||||
|
follow-redirects "^1.15.0"
|
||||||
|
form-data "^4.0.0"
|
||||||
|
proxy-from-env "^1.1.0"
|
||||||
|
|
||||||
axobject-query@^2.2.0:
|
axobject-query@^2.2.0:
|
||||||
version "2.2.0"
|
version "2.2.0"
|
||||||
resolved "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz"
|
resolved "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz"
|
||||||
@@ -6134,6 +6143,11 @@ follow-redirects@^1.0.0:
|
|||||||
resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz"
|
resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz"
|
||||||
integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==
|
integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==
|
||||||
|
|
||||||
|
follow-redirects@^1.15.0:
|
||||||
|
version "1.15.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
|
||||||
|
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
|
||||||
|
|
||||||
for-in@^1.0.2:
|
for-in@^1.0.2:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz"
|
resolved "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz"
|
||||||
@@ -6161,6 +6175,15 @@ form-data@^3.0.0:
|
|||||||
combined-stream "^1.0.8"
|
combined-stream "^1.0.8"
|
||||||
mime-types "^2.1.12"
|
mime-types "^2.1.12"
|
||||||
|
|
||||||
|
form-data@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
|
||||||
|
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
|
||||||
|
dependencies:
|
||||||
|
asynckit "^0.4.0"
|
||||||
|
combined-stream "^1.0.8"
|
||||||
|
mime-types "^2.1.12"
|
||||||
|
|
||||||
forwarded@0.2.0:
|
forwarded@0.2.0:
|
||||||
version "0.2.0"
|
version "0.2.0"
|
||||||
resolved "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz"
|
resolved "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz"
|
||||||
@@ -10154,6 +10177,11 @@ proxy-addr@~2.0.5:
|
|||||||
forwarded "0.2.0"
|
forwarded "0.2.0"
|
||||||
ipaddr.js "1.9.1"
|
ipaddr.js "1.9.1"
|
||||||
|
|
||||||
|
proxy-from-env@^1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
|
||||||
|
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
|
||||||
|
|
||||||
prr@~1.0.1:
|
prr@~1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz"
|
resolved "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz"
|
||||||
|
|||||||
Reference in New Issue
Block a user