Ignore:
Timestamp:
06/05/20 17:16:18 (4 years ago)
Author:
Maciej Komosinski
Message:

Added more questions to questionnaire

File:
1 edited

Legend:

Unmodified
Added
Removed
  • js/human_3d_alignment/src/index.jsx

    r918 r942  
    5353        window.logger = new Module.LoggerToStdout(Module.LoggerBase.Enable); // While this object exists, all messages emitted by SDK loggers will be printf()'ed and consequently will appear in the JS console.
    5454        this.layout = [
    55             {name:'0,textviewer', x: 0, y: 0, w: 9, h: 1},
     55            {name:'0,textviewer', x: 0, y: 0, w: 12, h: 1},
    5656            {name:'2,similviewer', x: 0, y: 1, w: 6, h: 4},
    5757            {name:'3,fitviewer', x: 6, y: 1, w: 6, h: 2},
    5858            {name:'4,sliderviewer', x: 6, y: 3, w: 6, h: 2},
    59             {name:'1,parmviewer', x: 9, y: 0, w: 3, h: 1}
     59            {name:'1,parmviewer', x: 9, y: 6, w: 12, h: 1}
    6060        ];
    6161
     
    8383            selectedGender: {value: "empty", label: " "},
    8484            selectedYear: {value: "empty", label: " "},
     85            selectedSleepHours: {value: "empty", label: " "},
     86            selectedSleepHoursToday: {value: "empty", label: " "},
     87            selectedHand: {value: "empty", label: " "},
     88            selectedYearsGamePlaying: {value: "empty", label: " "},
     89            selectedHoursGamePlaying: {value: "empty", label: " "},
     90            selectedMusicalExperience: {value: "empty", label: " "},
     91            selectedMusicalDuration: {value: "empty", label: " "},
     92            selectedLanguages: {value: "empty", label: " "},
     93            selectedSportYears: {value: "empty", label: " "},
     94            selectedSportHours: {value: "empty", label: " "},
     95            selectedSportType: {value: "empty", label: " "},
     96            selectedCons: {value: "empty", label: " "},
     97            selectedCalculations: {value: "empty", label: " "},
     98            selectedNavigation: {value: "empty", label: " "},
    8599            percent: 0,
    86100            sliderUpdated: true,
     
    110124        this.handleChangeIp = this.handleChangeIp.bind(this);
    111125        this.handleChangeGender =  this.handleChangeGender.bind(this);
     126        this.handleChangeHand =  this.handleChangeHand.bind(this);
     127        this.handleChangeYearsGamePlaying =  this.handleChangeYearsGamePlaying.bind(this);
     128        this.handleChangeHoursGamePlaying =  this.handleChangeHoursGamePlaying.bind(this);
    112129        this.handleChangeYear = this.handleChangeYear.bind(this);
     130        this.handleChangeSleepHours = this.handleChangeSleepHours.bind(this);
     131        this.handleChangeSleepHoursToday = this.handleChangeSleepHoursToday.bind(this);
     132        this.handleChangeMusicalExperience = this.handleChangeMusicalExperience.bind(this);
     133        this.handleChangeMusicalDuration = this.handleChangeMusicalDuration.bind(this);
     134        this.handleChangeLanguages = this.handleChangeLanguages.bind(this);
     135        this.handleChangeSportYears = this.handleChangeSportYears.bind(this);
     136        this.handleChangeSportHours = this.handleChangeSportHours.bind(this);
     137        this.handleChangeSportType = this.handleChangeSportType.bind(this);
     138        this.handleChangeCons = this.handleChangeCons.bind(this);
     139        this.handleChangeCalculations = this.handleChangeCalculations.bind(this);
     140        this.handleChangeNavigation = this.handleChangeNavigation.bind(this);
    113141        this.handleChangePercent = this.handleChangePercent.bind(this);
    114142        this.handleChangeStartTime = this.handleChangeStartTime.bind(this);
     
    144172        this.getIp();   //set user ip
    145173        this.genotypes = new Genotypes(this, "https://raw.githubusercontent.com/arturolejnik95/human_3d_alignment/master/walking.gen");   //load text from file to this.genotypes
    146         let head = "'User ID'|'User IP'|'Gender'|'Year of born'|'Start time'|'Stop time'|'Position of 1st'|'Position of 2nd'|'Rotation of 1st'|'Rotation of 2nd'|'ID 1st'|'ID 2nd'|'Fit'|'Result'\n"
     174        //or another URL...
     175        let head = "'User ID'|'User IP'|'Gender'|'Year of birth'|'Handeness'|'Sleep hours'|'Sleep hours today'|'YearsGamePlaying'|'HoursGamePlaying'|'Musical experience'|'MusicalDuration'|'Languages'|'SportYears'|'SportHours'|'SportType'|'Cons'|'Calculations'|'Navigation'|'Start time'|'Stop time'|'Position of 1st'|'Position of 2nd'|'Rotation of 1st'|'Rotation of 2nd'|'ID 1st'|'ID 2nd'|'Fit'|'Result'\n"
    147176        this.handleChangeResult(head);
    148177    }
     
    207236                    this.state.selectedGender.value + '|' +
    208237                    this.state.selectedYear.value + '|' +
     238                    this.state.selectedHand.value + '|' +
     239                    this.state.selectedSleepHours.value + '|' +
     240                    this.state.selectedSleepHoursToday.value + '|' +
     241                    this.state.selectedYearsGamePlaying.value + '|' +
     242                    this.state.selectedHoursGamePlaying.value + '|' +
     243                    this.state.selectedMusicalExperience.value + '|' +
     244                    this.state.selectedMusicalDuration.value + '|' +
     245                    this.state.selectedLanguages.value + '|' +
     246                    this.state.selectedSportYears.value + '|' +
     247                    this.state.selectedSportHours.value + '|' +
     248                    this.state.selectedSportType.value + '|' +
     249                    this.state.selectedCons.value + '|' +
     250                    this.state.selectedCalculations.value + '|' +
     251                    this.state.selectedNavigation.value + '|' +
    209252                    start + '|' +
    210253                    stop + '|' +
     
    243286        });
    244287       
    245         rawFile.open("POST", 'https://ptsv2.com/t/b7nhq-1578108725/post');
     288        rawFile.open("POST", 'https://ptsv2.com/t/b7nhq-1578108725/post'); //or another URL...
    246289        rawFile.setRequestHeader("Content-type", 'text/plain');
    247290        rawFile.send(fit);
     
    331374
    332375    /**
    333      * Check is user ready to go to the next question by checking choosed gender, birth year and percent of similarity
     376     * Check if the user is ready to go to the next question by checking if all the answers are selected
    334377     */
    335378    isReady() {
    336         if (this.state.selectedGender.value != 'empty' && this.state.selectedYear.value != 'empty' && this.state.sliderUpdated) {
     379        if (this.state.selectedSportType.value != 'empty' && this.state.selectedYearsGamePlaying.value != 'empty' && this.state.selectedHoursGamePlaying.value != 'empty' && this.state.selectedMusicalDuration.value != 'empty' && this.state.selectedLanguages.value != 'empty' && this.state.selectedSportYears.value != 'empty' && this.state.selectedSportHours.value != 'empty' && this.state.selectedCons.value != 'empty' && this.state.selectedCalculations.value != 'empty' && this.state.selectedNavigation.value != 'empty' && this.state.selectedMusicalExperience.value != 'empty' && this.state.selectedGender.value != 'empty' && this.state.selectedSleepHoursToday.value != 'empty' && this.state.selectedSleepHours.value != 'empty' && this.state.selectedHand.value != 'empty' && this.state.selectedYear.value != 'empty' && this.state.sliderUpdated) {
    337380            this.setState({isDisable: false}, function() {
    338381                console.log(this.state.isDisable);
     
    393436        this.setState({ selectedGender: gen }, function() {
    394437            console.log(`Gender selected:`, this.state.selectedGender);
     438            this.isReady();
     439        });
     440    };
     441   
     442     /**
     443     * Allow to change sport type in state
     444     * @param {string} sport type choosed sport type by user in listbox
     445     */
     446    handleChangeSportType(sporttype) {
     447        this.setState({ selectedSportType: sporttype }, function() {
     448            console.log(`Sport type selected:`, this.state.selectedSportType);
     449            this.isReady();
     450        });
     451    };
     452   
     453         /**
     454     * Allow to years game playing type in state
     455     * @param {string} gameyp type choosed years game playing by user in listbox
     456     */
     457    handleChangeYearsGamePlaying(gameyp) {
     458        this.setState({ selectedYearsGamePlaying: gameyp }, function() {
     459            console.log(`Years game playing selected:`, this.state.selectedYearsGamePlaying);
     460            this.isReady();
     461        });
     462    };
     463
     464         /**
     465     * Allow to hours game playing type in state
     466     * @param {string} gamehp type choosed hours game playing by user in listbox
     467     */   
     468    handleChangeHoursGamePlaying(gamehp) {
     469        this.setState({ selectedHoursGamePlaying: gamehp }, function() {
     470            console.log(`Hours game playing selected:`, this.state.selectedHoursGamePlaying);
    395471            console.log(this.genotypes.id.length)
     472            this.isReady();
     473        });
     474    };
     475   
     476    /**
     477     * Allow to change musical expereince in state
     478     * @param {string} musexp choosed musical expereince by user in listbox
     479     */
     480    handleChangeMusicalExperience(musexp) {
     481        this.setState({ selectedMusicalExperience: musexp }, function() {
     482            console.log(`Musical experience selected:`, this.state.selectedMusicalExperience);
     483            this.isReady();
     484        });
     485    };
     486   
     487     /**
     488     * Allow to change hand in state
     489     * @param {string} hand choosed hand by user in listbox
     490     */
     491    handleChangeHand(hand) {
     492        this.setState({ selectedHand: hand }, function() {
     493            console.log(`Hand selected:`, this.state.selectedHand);
     494            this.isReady();
     495        });
     496    };
     497   
     498     /**
     499     * Allow to change musical duration in state
     500     * @param {string} musdur choosed musical duration by user in listbox
     501     */
     502    handleChangeMusicalDuration(musdur) {
     503        this.setState({ selectedMusicalDuration: musdur }, function() {
     504            console.log(`Musical hours selected:`, this.state.selectedMusicalDuration);
     505            this.isReady();
     506        });
     507    };
     508   
     509     /**
     510     * Allow to languages hand in state
     511     * @param {string} languages choosed languages by user in listbox
     512     */
     513    handleChangeLanguages(languages) {
     514        this.setState({ selectedLanguages: languages }, function() {
     515            console.log(`Languages selected:`, this.state.selectedLanguages);
     516            this.isReady();
     517        });
     518    };
     519   
     520    /**
     521     * Allow to change sport years hand in state
     522     * @param {string} sportyr choosed sport years by user in listbox
     523     */
     524    handleChangeSportYears(sportyr) {
     525        this.setState({ selectedSportYears: sportyr }, function() {
     526            console.log(`Sport years selected:`, this.state.selectedSportYears);
     527            this.isReady();
     528        });
     529    };
     530   
     531     /**
     532     * Allow to change sport hours in state
     533     * @param {string} sporthr choosed sport hours by user in listbox
     534     */
     535    handleChangeSportHours(sporthr) {
     536        this.setState({ selectedSportHours: sporthr }, function() {
     537            console.log(`Sport hours selected:`, this.state.selectedSportHours);
     538            this.isReady();
     539        });
     540    };
     541   
     542    /**
     543     * Allow to change conscientiousness in state
     544     * @param {string} cons choosed hand by user in listbox
     545     */
     546    handleChangeCons(cons) {
     547        this.setState({ selectedCons: cons }, function() {
     548            console.log(`Conscientiousness selected:`, this.state.selectedCons);
     549            this.isReady();
     550        });
     551    };
     552   
     553     /**
     554     * Allow to change calculations in state
     555     * @param {string} calculations choosed calculations by user in listbox
     556     */
     557    handleChangeCalculations(calculations) {
     558        this.setState({ selectedCalculations: calculations }, function() {
     559            console.log(`Calculations selected:`, this.state.selectedCalculations);
     560            this.isReady();
     561        });
     562    };
     563   
     564     /**
     565     * Allow to change navigation in state
     566     * @param {string} navigation choosed navigation by user in listbox
     567     */
     568    handleChangeNavigation(navigation) {
     569        this.setState({ selectedNavigation: navigation }, function() {
     570            console.log(`Navigation selected:`, this.state.selectedNavigation);
    396571            this.isReady();
    397572        });
     
    435610        this.setState({ selectedYear: year }, function() {
    436611            console.log(`Birth year selected:`, this.state.selectedYear);
     612            this.isReady();
     613        });
     614    }
     615
     616        /**
     617     * Allow to change birth year in state
     618     * @param {number} year choosed birth year by user in listbox
     619     */
     620    handleChangeSleepHours(hours) {
     621        this.setState({ selectedSleepHours: hours }, function() {
     622            console.log(`Birth year selected:`, this.state.selectedSleepHours);
     623            this.isReady();
     624        });
     625    }
     626   
     627            /**
     628     * Allow to change birth year in state
     629     * @param {number} year choosed birth year by user in listbox
     630     */
     631    handleChangeSleepHoursToday(hours) {
     632        this.setState({ selectedSleepHoursToday: hours }, function() {
     633            console.log(`Birth year selected:`, this.state.selectedSleepHoursToday);
    437634            this.isReady();
    438635        });
     
    666863                case 'parmviewer':
    667864                    items.push({content: <ParmViewer
    668                             handleChangeYear = {(year) => {this.handleChangeYear(year)}}
     865                            handleChangeYear = {(year) => {this.handleChangeYear(year)}}
     866                            handleChangeSleepHours = {(hours) => {this.handleChangeSleepHours(hours)}}
     867                            handleChangeSleepHoursToday = {(hours) => {this.handleChangeSleepHoursToday(hours)}}                           
    669868                            handleChangeGender = {(gen) => {this.handleChangeGender(gen)}}
     869                            handleChangeSportType = {(gen) => {this.handleChangeSportType(gen)}}
     870                            handleChangeMusicalExperience = {(gen) => {this.handleChangeMusicalExperience(gen)}}
     871                            handleChangeHand = {(hand) => {this.handleChangeHand(hand)}}
     872                            handleChangeYearsGamePlaying = {(hand) => {this.handleChangeYearsGamePlaying(hand)}}
     873                            handleChangeHoursGamePlaying = {(hand) => {this.handleChangeHoursGamePlaying(hand)}}
     874                            handleChangeMusicalDuration = {(hand) => {this.handleChangeMusicalDuration(hand)}}
     875                            handleChangeLanguages = {(hand) => {this.handleChangeLanguages(hand)}}
     876                            handleChangeSportHours = {(hand) => {this.handleChangeSportHours(hand)}}
     877                            handleChangeSportYears = {(hand) => {this.handleChangeSportYears(hand)}}
     878                            handleChangeCons = {(hand) => {this.handleChangeCons(hand)}}
     879                            handleChangeCalculations = {(hand) => {this.handleChangeCalculations(hand)}}
     880                            handleChangeNavigation = {(hand) => {this.handleChangeNavigation(hand)}}                                               
    670881                        />,
    671882                        i: "" + i + 'parmviewer',
     
    718929            <span>   
    719930                <span style={{marginLeft: '20px', fontFamily: "'Fira Mono', Monaco, 'Andale Mono', 'Lucida Console', 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace"}}>
    720                     Ankieta
     931                    Badanie
    721932                </span>
    722933            </span>
Note: See TracChangeset for help on using the changeset viewer.