candlepin/candlepin — pull request #224 by jmrodri (2013-04-09 18:28:39+00:00)
Title: only get latest import record

We need the latest import record with a status of 0. Previously we got
*ALL* records with status of 0 even if the latest one was a delete
(status of 2).

TEST
--------
* deploy candlepin-0.8.0-1 tag (git checkout candlepin-0.8.0-1, then git checkout -b testbranch)
* cd client/ruby
* ./cpc import admin ~/og-cfse-906553.zip
* ./cpc import donaldduck ~/og-cfse-906553.zip (should fail but creates a needed import record)
* '''NOW INSERT''' (by hand) 2 new records into cp_import_record table such that the status will be 0 and 2 and the 2 being the latest. We want to ensure that this record does NOT get inserted into cp_upstream_consumer
* now checkout this branch (the one containing this patch) and run the liquibase update scripts:
```
liquibase --driver=org.postgresql.Driver --classpath=src/main/resources/:target/classes/:/usr/share/java/postgresql-jdbc.jar --changeLogFile=db/changelog/changelog-update.xml --url=jdbc:postgresql:candlepin --username=candlepin --logLevel=debug update -Dcommunity=True```