update_teach_links: update_teach_links

View source: R/update_teach_links.R

update_teach_linksR Documentation

Description

Searches lesson's google drive folder to populate the 'TeachMatLinks' tab of the lesson's 'meta/teach-it_.gsheet' file. Merges these detected file names and links with manually added "extLink" links to learning resources hosted elsewhere. 90% of this algorithm uses drive_ functions, so it's rather slow. It does save a state of files (see step 7 in details) using the virtualized path, though. This is used to skip updating if all files are up to date.

Usage

update_teach_links(
  WD = "?",
  rebuild = NULL,
  rm_missing = TRUE,
  clean = FALSE,
  ignore = ".txt$"
)

Arguments

WD

a local virtualized path to a lesson folder where Google Drive (Web) path will be extracted from front matter. Easiest is to pass "?" which will invoke pick_lesson()

rebuild

deprecated!! if T, rebuild everything; overrides checks of last modified times before updating links and teach-it.gsheet; default= NULL

rm_missing

logical; do you want to automatically remove records that are missing (and for which no link was found during crawl of Google Drive folder?); default= TRUE; if FALSE, the link will be left blank

clean

logical; do you want to ignore all info on the teach-it.gsheet and only import inferred info from crawled google drive project files? THIS WILL OVERWRITE MANUALLY ENTERED TITLES; default=FALSE

ignore

regex expression to remove certain filetypes (e.g. txt files); default= ".txt$"

Details

It's a hybrid lookup system that requires Google Drive for Desktop to be setup with permission to GP-Studio shared drive and a web connection. Steps:

  1. Find WD working directory corresponding to the chosen lesson

  2. Access the cloud version of the project folder by finding the 'GdriveDirID' in meta/front-matter.yml.

  3. Search through web folders, compiling information from folder and naming structure in 'teaching-materials' folder.

  4. Get Gdrive links for downloads, classroom- and remote- lessons, and assessments.

  5. Merge results with manually entered titles and such in 'meta/teach-it.gsheet TeachMatLinks tab'

  6. Save 'meta/teach-it.gsheet'

  7. Save teach-it_state.RDS that stores info about the teaching-materials folder at the time of the last update. compile_lesson() uses get_state() to check if the current state is identical to the state at the time of the last update to skip this update_teach_links call.

See Also

Other Google Drive Functions: drive_contents(), drive_copy_missing_files(), drive_cp_dir(), drive_find_path(), drive_get_info(), drive_inSync(), drive_new_from_template(), drive_open(), init_lesson_meta()


galacticpolymath/GPpub documentation built on April 5, 2025, 6:04 p.m.