Open ogsteele opened 4 years ago
@amchagas - had a particularly busy period of experiments and am now back doing data analysis for a little while so will be working a little more on this to break up my day! Had a (very likely) stupid question about the autopost.r
script.
Looking at eventer-neuroscience/resources/eventer_autopost.R
I'm just trying to understand how the final section ...
# change posted to TRUE on google sheets
# I think it is safe to overwrite directly here
target$posted <- str_replace_all(string = target$`Model Name`,
pattern = " ", replacement = "_") %in%
list.files("/content/post/")
# overwrite the original!
write_sheet(target %>% select(original_columns),ss = ID, sheet=1)
... actually changes the text on the google sheet to say posted = TRUE. Rendering the site locally I'm able to run this nicely and populate posts that appear in the correct directory and render on the website. The only thing I'm not seeing change is posted = FALSE on the google sheet associated with the google form. What incredibly obvious thing am I missing?
Hi @ogsteele it normally does not create FALSE entries for things that are not up yet,.. it simply leaves that field blank... so it should be TRUE or blank in normal cases (which is a bit counter intuitive I know)
It is just that this specific field is not on the form itself, only on the spreadsheet and it gets added/filled out by the autopost.R function...
You mention that you can see things locally, does that imply that things are not updating on netlify?
Yep, it's all updating on netlify (I in fact only noticed that it was the case today and have amended the eventer repository webpage to now show 'under construction' - the rest of the website is fine for now, it's just that bit that needs tweaking).
I think I'm still a little confused ... I understand that field is not there and only added by the script. TRUE = posted, blank = not posted. So in my case, I have two 'FALSE' fields, why is that? Is that what is causing autopost.R to read those rows and generate a post on the website (and all the relevant folders/files in the directories) even after I delete the posts from the directory. Is Autopost.R not able to recognise the FALSE statement so it's not putting TRUE in that field?
I had another look at the script and see what you mean with the whole TRUE/FALSE thing. I think it has something to do with the way it changes titles (on open neuroscience, we have to remove things like quotation marks from the titles, so that it doesn't cause issues with the YAML part of the MD file).
It changes titles twice and I spotted differences between the two times. So it maybe related to the script checking the folder name with one of the modified titles and not finding the exact name... I have to have a closer look. I did update the ON version of the script, but it is not 100% yet
Somewhere to start at least, I'll have a look too when I get a chance - thanks!
Ddid you ever get this sorted for open neuro in the end @amchagas? I was just having a look and got no closer ...
See below the changes today and yesterday that I think fixes this issue and in my (admittedly lazy) opinion makes things a little smoother for others. I also discovered an issue with full stops in creating foldernames on OSX at least. A submission had a full stop in the name, and it all freaked out a bit.
eventer-neuroscience/resources@cf48511 - package installation if required
eventer-neuroscience/resources@b72191b - adds in an if statement so the code will still run if there's nothing to post, and adds a comment suggesting a beer is therefore required ...
eventer-neuroscience/resources@51fbdf3 - fixes the posted = TRUE issue we've been seeing.
I might make some changes to the tag functionality over the next day or two as we might tweak the form, but that SHOULDN'T create this issue again.
Google form allows doc to uploaded to Google Drive (Eventer Neuro Google Drive) which can either be accessed through that URL or by downloading into eventer-fresh itself (this may slow the website once It gets too big, but is all in one location.). The following R file download guide may be helpful.
Begin work shortly to edit the open-neuro autopost.r