Ad
  • Custom User Avatar

    .

  • Custom User Avatar

    I think I'm missing something. I have multiple problems with random tests, f.i. this SQL:

    select movie.directorid, actor.name, director.id FROM director JOIN movie on movie.directorID = director.id JOIN actor_to_movie on actor_to_movie.movieID = movie.id join actor on actor.id = actor_to_movie.actorID where director.name = 'Jon Favreau'
    

    The test expect an empty array as the result, but the database has movies with that director, and the SQL seems to have all the needed joins as far as I can tell. It could be I haven't used SQL in a long time, but I fail to see the problem here.

    PS: Btw, I forgot the test result:
    Expected: '[]', instead got: '[{ \'movie.directorid\': 5,\n \'actor.name\': \'Robert Downey Jr.\',\n \'director.id\': 5 }, { \'movie.directorid\': 5,\n \'actor.name\': \'Gwyneth Paltrow\',\n \'director.id\': 5 }, { \'movie.directorid\': 5,\n \'actor.name\': \'Terrence Howard\',\n \'director.id\': 5 }, { \'movie.directorid\': 5,\n \'actor.name\': \'Jeff Bridges\',\n \'director.id\': 5 }]'

  • Custom User Avatar

    Oh! I see it now.

    Thanks!

  • Custom User Avatar

    That's the first part of the output, after that, inspect logs keep coming but no more bulletin logs, there's only one of those at the top.

    This is because the tests terminated early due to the STDERR that occurred. And if your solution is returning incorrect values, it will terminate the tests early. The reason you're only seeing one bulletin is because the tests terminated before getting past the first day.

    Also, do you have a date there, at the beginning of the log you copied? I don't have that either.

    You do have it, it shows up in green(?); it's not from a console.log, but rather from an it or describe block (i.e. unit test).

    As for the question about the date, it's provided in the Description under Conditions for passing inspection: All documents are current (ie. none have expired) -- a document is considered expired if the expiration date is November 22, 1982 or earlier

  • Custom User Avatar

    That's the first part of the output, after that, inspect logs keep coming but no more bulletin logs, there's only one of those at the top. I copy/paste:

    ********* BULLETIN
    [ 'entrants require passport',
      'allow citizens of arstotzka',
      'wanted by the state: danika stoyakovich' ]
    [ 'entrants', 'require', 'passport' ]
    [ 'allow', 'citizens', 'of', 'arstotzka' ]
    [ 'wanted', 'by', 'the', 'state:', 'danika', 'stoyakovich' ]
    
    *********** INSPECTOR
    
    *********** INSPECT
    2
    false
    
    *********** INSPECT
    { passport:
       'ID#: C4LQ4-R4IZB\nNATION: Impor\nNAME: Hammacher, Andrej\nDOB: 1948.08.14\nSEX: M\nISS: Tsunkeido\nEXP: 1983.12.14' }
    [ Document {
        docName: 'passport',
        isValid: true,
        'id#': 'c4lq4-r4izb',
        nation: 'impor',
        name: 'hammacher, andrej',
        dob: '1948.08.14',
        sex: 'm',
        iss: 'tsunkeido',
        exp: '1983.12.14' } ]
    
    *********** INSPECT
    { passport:
       'ID#: BB1H9-WB46F\nNATION: Obristan\nNAME: Kaczynska, Viktor\nDOB: 1921.04.04\nSEX: M\nISS: Lorndaz\nEXP: 1984.01.04' }
    [ Document {
        docName: 'passport',
        isValid: true,
        'id#': 'bb1h9-wb46f',
        nation: 'obristan',
        name: 'kaczynska, viktor',
        dob: '1921.04.04',
        sex: 'm',
        iss: 'lorndaz',
        exp: '1984.01.04' } ]
    
    *********** INSPECT
    { passport:
       'ID#: VTT0I-XN9K4\nNATION: Arstotzka\nNAME: Stanislov, Cesar\nDOB: 1958.04.21\nSEX: M\nISS: East Grestin\nEXP: 1983.09.24' }
    [ Document {
        docName: 'passport',
        isValid: true,
        'id#': 'vtt0i-xn9k4',
        nation: 'arstotzka',
        name: 'stanislov, cesar',
        dob: '1958.04.21',
        sex: 'm',
        iss: 'east grestin',
        exp: '1983.09.24' } ]
    
    *********** INSPECT
    { passport:
       'ID#: OSA5Z-JWN3D\nNATION: Arstotzka\nNAME: Stolichnaya, Olec\nDOB: 1916.06.12\nSEX: M\nISS: East Grestin\nEXP: 1984.05.20' }
    [ Document {
        docName: 'passport',
        isValid: true,
        'id#': 'osa5z-jwn3d',
        nation: 'arstotzka',
        name: 'stolichnaya, olec',
        dob: '1916.06.12',
        sex: 'm',
        iss: 'east grestin',
        exp: '1984.05.20' } ]
    
    ...(many more inspect calls)
    

    As you can see there's only one bulletin, after that all inspections keep coming all together without any other bulletin call.
    Also, do you have a date there, at the beginning of the log you copied? I don't have that either.
    And I have this error at the end, I'm not sure what it means:

     STDERR
    (node:29) [DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated
    
  • Custom User Avatar

    The two methods are being called. In the tests, there are 31 days of service. At the start of each day, the receiveBulletin method is called, then the inspect method is called on each entrant for that day.

    I'm not sure what you're reading, but when I tested your solution this is the first console log that appeared:

     November 23rd, 1982
    Log
    ********* BULLETIN
    [ 'entrants require passport',
      'allow citizens of arstotzka',
      'wanted by the state: ilya dvorkin' ]
    [ 'entrants', 'require', 'passport' ]
    [ 'allow', 'citizens', 'of', 'arstotzka' ]
    [ 'wanted', 'by', 'the', 'state:', 'ilya', 'dvorkin' ]
    
    *********** INSPECTOR
    
    *********** INSPECT
    2
    false
    
    *********** INSPECT
    { passport: 'ID#: TFSY0-WJ2M4\nNATION: Obristan\nNAME: Olah, Werner\nDOB: 1958.07.20\nSEX: M\nISS: Skal\nEXP: 1981.01.19' }
    

    The things you're describing are not what is happening when I run your solution.

  • Custom User Avatar

    Maybe someone could help me, I'm on javascript. I don't understand how the tests work.

    I have logs both in my receiveBulletin and inspect functions, and it seems that recieveBulletin is getting called only one time, but from the tests messages I'm seeing that the data passed through that function are supposed to change between cases (wanted person, nations denied or allowed, etc), and I'm failing cases because of this.

    I supposed that test cases would call receiveBulletin before inspect, but my logs are not being called(first line of receiveBulletin is "console.log("********* BULLETIN")"...), so the function are not being called and the data are not being updated, therefore the tests fails.

    Also, is date supposed to change? I haven't seen anything about this in the description of the kata, only says date is 1982-11-23.

    Also, the logs are not next to the each test case, they are all together at the top of the output window and then all the results at the bottom... is this normal? never seen it before this way at codewars.

    I love the theme of the kata but... I'm missing something important or it's a really weird kata.

  • Custom User Avatar

    "answer"