Skip to content

Instantly share code, notes, and snippets.

@JCGrant
Created November 11, 2016 20:41
Show Gist options
  • Save JCGrant/3bcd4a94ac7e7ca1d67ef33c1bbdb051 to your computer and use it in GitHub Desktop.
Save JCGrant/3bcd4a94ac7e7ca1d67ef33c1bbdb051 to your computer and use it in GitHub Desktop.
A quick script to filter out any projects that have been fully allocated at https://project-portal.doc.ic.ac.uk/proposal_selection
const available = (tr) => {
let tds = tr.getElementsByTagName('td');
let title_td = tds[2];
let title_text = title_td.textContent;
let num_allocated_str = title_text[title_text.length - 2];
let num_allocated = parseInt(num_allocated_str);
let num_places_available_td = tds[5];
let num_places_available_str = num_places_available_td.textContent;
let num_places_available = parseInt(num_places_available_str);
return num_allocated < num_places_available;
};
let table = document.getElementsByTagName('tbody')[3];
let tr_collection = table.getElementsByTagName('tr');
let tr_array = Array.from(tr_collection);
let not_available_trs = tr_array.filter((tr) => !available(tr));
not_available_trs.forEach(tr => tr.hidden = true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment