diff --git a/README.md b/README.md
index 7db80e4..63fed49 100644
--- a/README.md
+++ b/README.md
@@ -1,24 +1,7 @@
-# README
+asbo:
+an aggregator of a few London-based internet radio stations - using Nokogiri to scrape the html where needed, caching the resulting objects in a local db
-This README would normally document whatever steps are necessary to get the
-application up and running.
+backend is in rails, front-end is in react/redux
-Things you may want to cover:
-
-* Ruby version
-
-* System dependencies
-
-* Configuration
-
-* Database creation
-
-* Database initialization
-
-* How to run the test suite
-
-* Services (job queues, cache servers, search engines, etc.)
-
-* Deployment instructions
-
-* ...
+to start the backend api and the client, use the following command:
+$ foreman start
diff --git a/app/controllers/platforms_controller.rb b/app/controllers/platforms_controller.rb
index f572a65..4c83248 100644
--- a/app/controllers/platforms_controller.rb
+++ b/app/controllers/platforms_controller.rb
@@ -47,6 +47,7 @@ def delete_episodes
begin
platform_from_nickname_param
@platform.episodes.delete_all
+ @platform.update(last_page: 0)
render json: {
:success => :true,
:platform => platform_with_episodes
diff --git a/app/javascripts/__mocks__/api.js b/app/javascripts/__mocks__/api.js
index 289c4a0..6f997ac 100644
--- a/app/javascripts/__mocks__/api.js
+++ b/app/javascripts/__mocks__/api.js
@@ -14,8 +14,9 @@ const MockAPI = class {
}
getPlatform({nickname}){
- // console.log(`mockAPI.fetch /platforms/${nickname}`)
- const platform = platforms.find(p => p.nickname == nickname)
+ console.log(`mockAPI.fetch /platforms/${nickname}`)
+ let platform = platforms.find(p => p.nickname == nickname)
+
return new Promise((resolve,reject) => {
if(!!platform) {
setTimeout(resolve, 0, {
@@ -38,7 +39,7 @@ const MockAPI = class {
// in the real api, filter is passed to backend so repsonse contains a sub-set of total items..
// in the mock api, the filter is just post-processing in the callback
refreshPlatform({nickname,filter,page}){
- console.log(`mockAPI.fetch /platforms/${nickname}/refresh ${JSON.stringify({filter,page})}`);
+ // console.log(`mockAPI.fetch /platforms/${nickname}/refresh ${JSON.stringify({filter,page})}`);
const platform = platforms.find(p => p.nickname == nickname)
return new Promise((resolve,reject) => {
if(!platform) {
@@ -51,7 +52,9 @@ const MockAPI = class {
//console.log(totalEps.map(ep => ep.name))
const matches = totalEps.filter(e => this.isMatchingEpisode(e, filter))
setTimeout(resolve, 0, {
- ...platform, episodes: matches
+ ...platform,
+ last_page: (platform.last_page + 1),
+ episodes: matches
})
}
})
diff --git a/app/javascripts/__mocks__/platforms.js b/app/javascripts/__mocks__/platforms.js
index e876f6e..09ad2af 100644
--- a/app/javascripts/__mocks__/platforms.js
+++ b/app/javascripts/__mocks__/platforms.js
@@ -27,7 +27,8 @@ export default [{
"100x100",
"800x800"
]
- }]
+ }],
+ "last_page" : 0
},
{
"id": 2,
@@ -51,7 +52,8 @@ export default [{
"nickname": "rinse",
"use_relative_images": false,
"default_image": "https://etc.levels.io/rinse-fm/logo.png",
- "post_processing_rules": null
+ "post_processing_rules": null,
+ "last_page" : 3
}, {
"id": 3,
"name": "radar radio",
@@ -75,5 +77,6 @@ export default [{
"nickname": "radar",
"use_relative_images": true,
"default_image": null,
- "post_processing_rules": null
+ "post_processing_rules": null,
+ "last_page" : 2
}]
\ No newline at end of file
diff --git a/app/javascripts/components/PlatformDetails.js b/app/javascripts/components/PlatformDetails.js
index aebadba..7e1a83a 100644
--- a/app/javascripts/components/PlatformDetails.js
+++ b/app/javascripts/components/PlatformDetails.js
@@ -19,6 +19,7 @@ class PlatformDetails extends Component {
pagination,
refreshPlatform,
episodes,
+ last_page,
currentPage
} = this.props
@@ -53,7 +54,8 @@ class PlatformDetails extends Component {
Edit Platform
- Episodes{' '}{this.refreshButton()}{' '}{this.deleteEpisodesButton()}
+ Episodes{' '}{this.refreshButton()}{' '}{this.deleteEpisodesButton()}
+ Last page fetched: {last_page}
{this.episodeGrid()} diff --git a/app/javascripts/components/PlatformForm.js b/app/javascripts/components/PlatformForm.js index 7a189cb..01fe50f 100644 --- a/app/javascripts/components/PlatformForm.js +++ b/app/javascripts/components/PlatformForm.js @@ -11,7 +11,7 @@ class PlatformForm extends Component { render() { const {initialValues, handleSubmit, pristine, reset, submitting, loading, isNew } = this.props const {nickname} = initialValues || {} - + console.log(initialValues) return (