Skip to content

add 2 new endpoint to the api#43

Merged
wilsonge merged 10 commits intojoomla:masterfrom
alikon:patch-4
Apr 11, 2020
Merged

add 2 new endpoint to the api#43
wilsonge merged 10 commits intojoomla:masterfrom
alikon:patch-4

Conversation

@alikon
Copy link
Copy Markdown

@alikon alikon commented Apr 8, 2019

rework of #40, #41

Summary of Changes

added 2 new end-point

  • cms_php_version
  • db_type_version

added 2 new tables
updated triggers

Testing Instructions

  • create the new 2 tables
  • drop the 2 triggers and execute the new 2 trigger
  • populate the new tables for the 1st time

api endpoint

?source=cms_php_version

Screenshot from 2019-04-08 20-00-16

api endpoint

?source=db_type_version

Screenshot from 2019-04-08 20-02-16

when authorized you should expect something like :

Screenshot from 2019-04-08 20-06-38

@alikon
Copy link
Copy Markdown
Author

alikon commented May 13, 2019

@mbabker @wilsonge may i have some feedback on this one ?

Copy link
Copy Markdown

@wilsonge wilsonge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me

@alikon
Copy link
Copy Markdown
Author

alikon commented Feb 12, 2020

as no one cares let's close it

@alikon alikon closed this Feb 12, 2020
@alikon alikon reopened this Mar 12, 2020
@alikon
Copy link
Copy Markdown
Author

alikon commented Mar 12, 2020

let's hope in another chance

@wilsonge
Copy link
Copy Markdown

I think travis is failing because it needs a migrations sql file too?

@alikon
Copy link
Copy Markdown
Author

alikon commented Mar 12, 2020

where ? and why?
cause no migration needed there are 2 new tables
so my question is migrate what ?

@mbabker
Copy link
Copy Markdown

mbabker commented Mar 12, 2020 via email

@alikon
Copy link
Copy Markdown
Author

alikon commented Mar 12, 2020

so what i should do... please help me

@wilsonge
Copy link
Copy Markdown

@mbabker where does travis actually populate the db? Currently missing the place where schema is populated

@alikon migrations folder located https://github.com/joomla/statistics-server/tree/master/etc/migrations create a new file similar to others already there

@mbabker
Copy link
Copy Markdown

mbabker commented Mar 12, 2020

This line inside the tests. Database is seeded as needed.

@mbabker
Copy link
Copy Markdown

mbabker commented Mar 12, 2020

(Also, don’t put anything with triggers that use different delimiters inside the migrations, those don’t get parsed out right by PDO so those bits I do have to manually run on the database when ready)

@wilsonge
Copy link
Copy Markdown

cool. you ok to create the migrations file in that case @alikon ?

@mbabker
Copy link
Copy Markdown

mbabker commented Mar 12, 2020

Also, just looking at the screenshots, would it not be better to use nested objects instead of complex strings for these groupings?

Instead of:

{
    "data": {
        "cms_php_version": {
            "3.9.16 - 7.4.3": 123,
            "3.9.16 - 7.4.2": 123,
            "3.9.16 - 7.4.1": 123,
            "3.9.16 - 7.4.0": 123
        }
    },
    "total": 492
}

Do this?

{
    "data": {
        "cms_php_version": {
            "3.9.16": {
                "7.4.3": 123,
                "7.4.2": 123,
                "7.4.1": 123,
                "7.4.0": 123
            }
        }
    },
    "total": 492
}

@alikon
Copy link
Copy Markdown
Author

alikon commented Mar 13, 2020

migration file created but travis still complain
https://travis-ci.org/github/joomla/statistics-server/jobs/661838497#L276

@mbabker
Copy link
Copy Markdown

mbabker commented Mar 13, 2020

If you can run the tests local (which you should be able to, it's basically copy phpunit.xml.dist to phpunit.xml and fill in database creds), add some var dumps to see what migrations are being run. I don't get why the base table doesn't exist (which is the source of the 9 errors) otherwise.

As for the failures:

1) Joomla\StatsServer\Tests\Database\MigrationsTest::testTheMigrationStatusIsCheckedAfterExecutingTheFirstMigration
Failed asserting that 2 is identical to 1.
/home/travis/build/joomla/statistics-server/tests/Database/MigrationsTest.php:65

For this one, the test needs to be updated. I think instead of $this->assertSame(1, $status->missingMigrations);, $this->assertGreaterThanOrEqual(1, $status->missingMigrations); should work here and prevent it needing updated every time a migration is added.

For the view failures, I have no idea how you've changed the builder but it's implying that the JSON is no longer being built correctly (because realistically since the model data is being mocked those shouldn't be failing if you're adding new keys).

@mbabker
Copy link
Copy Markdown

mbabker commented Mar 13, 2020

  1. Do a pull, I fixed a couple of things

  2. Merge master, it's a well bit behind and made it impossible for me to run PHPUnit locally

  3. How you've added the sources to the StatisticsRepository class won't work, more specifically it has broken getRecentlyUpdatedItems() because there aren't columns for these two dynamic fields

@alikon
Copy link
Copy Markdown
Author

alikon commented Mar 15, 2020

i've modified the getRecentlyUpdatedItems() to manage the 2 new

@alikon
Copy link
Copy Markdown
Author

alikon commented Mar 15, 2020

wow travis is happy now
me quite confused now cause locally i still got 2 error and 5 failure
Screenshot from 2020-03-15 10-18-31

@wilsonge
Copy link
Copy Markdown

wilsonge commented Apr 7, 2020

@alikon can you merge in master here

@alikon
Copy link
Copy Markdown
Author

alikon commented Apr 7, 2020

i'm not allowed to do this from the github UI
so i need your helps if this still matter

@wilsonge wilsonge merged commit 50614b9 into joomla:master Apr 11, 2020
@wilsonge
Copy link
Copy Markdown

It would be better. I think I'm just going to fix forwards here if things break. travis seems to suggest things are ok. so fingers crossed

@alikon alikon deleted the patch-4 branch April 11, 2020 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants