Jump to content

RohanH

Members
  • Posts

    35
  • Joined

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

RohanH's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks for the help, also the explanation for each step which cleared certain concepts for me! 🙂
  2. I want to display the column in the cli but I fail to do so! This is what I tried to print in cli. foreach($results_by_date as $name => $work) { foreach($work as $kdate => $date) { if($kdate == 'date'){ echo $date. "\n"; }else{ foreach($date as $kdata => $date_data){ foreach($date_data as $kdatakey => $data){ echo " " . $data. "\n"; } } } } }
  3. how we do so using assertions or it will be simple try and catch (I mean to ask is how to we realize that the test failed)? Another question is to run the test do we create the test function (using the foreach loops and print the column value?) and then call the file like ?
  4. And again, if we want to test this json?
  5. okay, and as per the random order of data in our table will it still work?
  6. No clue, they just skyped me the zip which had this broken html code.
  7. Will it still not be an issue to detect the data pattern and assign the field names?
  8. And just realized that. Also realized that no matter what we do because there is no identifiable pattern we cannot get the field names and data organized. They got the table so messed up! I am not sure how they want us to figure out which field belongs to which data, do you suggest me to submit the task without the field names? Because, from where I can see the data is ultimately going to be incorrect given the field names, also they want us to perform the test what test can we really perform in this json data model?
  9. So, the sequence was given as an example i am just using that as a reference. for ($i = 1; $i <= 4; $i++) { foreach ($results[$i] as $key => $sdata) { if (!empty($sdata[0]) && $sdata[0] != '&nbsp;') { if ($sdata[0] == 'N/A') { $res[$key]['student_details'] = $sdata[0]; } else { foreach ($sdata as $rkey => $rdata) { $replace_nbsp = str_replace("&nbsp;", "null", $rdata); if ($rkey == 0) { $new_arr['student_id'] = ($rdata != '&nbsp;') ? $rdata : $replace_nbsp; } else if ($rkey == 1) { $new_arr['report_time'] = ($rdata != '&nbsp;') ? $rdata : $replace_nbsp; } else if ($rkey == 2) { $new_arr['leaving_time'] = ($rdata != '&nbsp;') ? $rdata : $replace_nbsp; } else if ($rkey == 3) { $new_arr['office'] = ($rdata != '&nbsp;') ? $rdata : $replace_nbsp; } else if ($rkey == 4) { $new_arr['start_time'] = ($rdata != '&nbsp;') ? $rdata : $replace_nbsp; } else if ($rkey == 5) { $new_arr['destination'] = ($rdata != '&nbsp;') ? $rdata : $replace_nbsp; } } $res[$key]['student_details'][] = $new_arr; } } } }
  10. What can possibly be the criteria to test the json output in this case, can you suggest? so that I can be aware of them and maybe show an example too?
  11. {"0":{"date":"May29Tue","student_details":"N\/A"},"1":{"date":"May30Wed","student_details":[{"student_id":"AAVL","report_time":"06:00","leaving_time":"14:00","office":"null","start_time":"null","destination":"null"}]},"2":{"date":"May31Thu","student_details":[{"student_id":"8751","report_time":"03:55","leaving_time":"04:55","office":"WFH","start_time":"COMP AVL","destination":"08:00"},{"student_id":"8752","report_time":"08:35","leaving_time":"COMP AVL","office":"WFH","start_time":"11:55","destination":"12:25"}]},"3":{"date":"Jun01Fri","student_details":[{"student_id":"8462","report_time":"04:30","leaving_time":"05:30","office":"WFH","start_time":"COMP NOT AVL","destination":"07:10"},{"student_id":"8465","report_time":"07:45","leaving_time":"COMP NOT AVL","office":"WFH","start_time":"09:20","destination":"09:50"}]},"4":{"date":"Jun02Sat","student_details":[{"student_id":"CBSE","report_time":"02:00","leaving_time":"10:00","office":"null","start_time":"null","destination":"null"}]},"5":{"date":"Jun03Sun","student_details":"N\/A"},"6":{"date":"Jun04Mon","student_details":"N\/A"},"7":{"date":"Jun05Tue","student_details":"N\/A"},"8":{"date":"Jun06Wed","student_details":"N\/A"},"9":{"date":"Jun07Thu","student_details":"N\/A"},"10":{"date":"Jun08Fri","student_details":[{"student_id":"8113","report_time":"05:05","leaving_time":"06:05","office":"WFH","start_time":"ZRH","destination":"07:50"},{"student_id":"8114","report_time":"08:25","leaving_time":"ZRH","office":"WFH","start_time":"10:10","destination":"null"},{"student_id":"8277","report_time":"11:05","leaving_time":"WFH","office":"MAD","start_time":"13:40","destination":"14:10"}]},"11":{"date":"Jun09Sat","student_details":[{"student_id":"8274","report_time":"04:00","leaving_time":"05:00","office":"MAD","start_time":"WFH","destination":"07:25"},{"student_id":"8221","report_time":"08:10","leaving_time":"WFH","office":"VLC","start_time":"10:30","destination":"null"},{"student_id":"8222","report_time":"11:05","leaving_time":"VLC","office":"WFH","start_time":"14:00","destination":"14:30"}]},"12":{"date":"Jun10Sun","student_details":"N\/A"},"13":{"date":"Jun11Mon","student_details":"N\/A"},"14":{"date":"Jun12Tue","student_details":[{"student_id":"AAVL","report_time":"05:15","leaving_time":"13:15","office":"null","start_time":"null","destination":"null"}]},"15":{"date":"Jun13Wed","student_details":[{"student_id":"8973","report_time":"04:05","leaving_time":"05:05","office":"WFH","start_time":"SOF","destination":"08:05"},{"student_id":"8974","report_time":"08:50","leaving_time":"SOF","office":"WFH","start_time":"12:10","destination":"12:40"}]},"16":{"date":"Jun14Thu","student_details":[{"student_id":"ADTY","report_time":"09:30","leaving_time":"16:30","office":"null","start_time":"null","destination":"null"}]},"17":{"date":"Jun15Fri","student_details":[{"student_id":"8233","report_time":"12:25","leaving_time":"13:25","office":"WFH","start_time":"SSP","destination":"15:40"},{"student_id":"8237","report_time":"16:10","leaving_time":"SSP","office":"WFH","start_time":"18:25","destination":"18:55"}]},"18":{"date":"Jun16Sat","student_details":"N\/A"},"19":{"date":"Jun17Sun","student_details":"N\/A"},"20":{"date":"Jun18Mon","student_details":[{"student_id":"807","report_time":"11:35","leaving_time":"12:35","office":"WFH","start_time":"OMV","destination":"14:10"},{"student_id":"808","report_time":"14:35","leaving_time":"OMV","office":"WFH","start_time":"16:15","destination":"null"},{"student_id":"837","report_time":"16:50","leaving_time":"WFH","office":"BFS","start_time":"18:25","destination":"null"},{"student_id":"840","report_time":"18:55","leaving_time":"BFS","office":"WFH","start_time":"20:25","destination":"20:55"}]},"21":{"date":"Jun19Tue","student_details":[{"student_id":"8551","report_time":"10:50","leaving_time":"11:50","office":"WFH","start_time":"MJV","destination":"14:30"},{"student_id":"8552","report_time":"15:00","leaving_time":"null","office":"WFH","start_time":"17:40","destination":"null"},{"student_id":"8187","report_time":"18:55","leaving_time":"WFH","office":"LIN","start_time":"20:50","destination":"21:20"}]},"23":{"date":"N\/A","student_details":[{"student_id":"06:00","report_time":"14:00","leaving_time":"null","office":"null","start_time":"null","destination":"null"}]},"24":{"date":"AAVL","student_details":[{"student_id":"03:55","report_time":"04:55","leaving_time":"WFH","office":"COMP AVL","start_time":"08:00","destination":"null"},{"student_id":"08:35","report_time":"COMP AVL","leaving_time":"WFH","office":"11:55","start_time":"12:25","destination":"null"}]},"25":{"date":"8751","student_details":[{"student_id":"04:30","report_time":"05:30","leaving_time":"WFH","office":"COMP NOT AVL","start_time":"07:10","destination":"null"},{"student_id":"07:45","report_time":"COMP NOT AVL","leaving_time":"null","office":"09:20","start_time":"09:50","destination":"null"}]},"26":{"date":"8462","student_details":[{"student_id":"02:00","report_time":"10:00","leaving_time":"null","office":"null","start_time":"null","destination":"null"}]}} This here is the output, which I parsed to json that is the format they want for the output. And there is no such criteria for the test is defined, it simply says that the output must be validated by a test.
  12. Yes, that is what I intend to do basically but I am not sure how! Final task says I will need to validate the output with a test.
  13. But dont i need to write some script to perform the test on the output ?
  14. FINALLY !! Thank you ... It works... !!!😀 Now, one last doubt if I want to perform test in this(also get the output in command line) how can I do that?
  15. If they want me to add the N/A, No Record etc, in the same array along with the dates what do we change here? And when they talk about test here what can possibly be the test? it says : " Validates the output with a test, executable from command line along with the result."
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.