Created
November 7, 2018 23:29
-
-
Save DewofyourYouth/8e3ced1e43afb956381a889881ac025b to your computer and use it in GitHub Desktop.
A scheduler for studying tractate Nazir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onEdit(e) { | |
// Interact with Sheets App | |
var app = SpreadsheetApp; | |
// get current active sheet | |
var activeSheet = app.getActiveSpreadsheet().getActiveSheet(); | |
// gets the amount of blatt in Nazir | |
var blattInNazir = activeSheet.getRange("B2").getValue(); | |
// Log blattInNazir | |
Logger.log("There are " + blattInNazir + " blatt in Nazir"); | |
// The gemara starts on daf 2 | |
var start = activeSheet.getRange("D2").getValue(); | |
var learnt = activeSheet.getRange("E2").getValue(); | |
// Ends on daf 66 (there are 65 blatt) | |
var end = blattInNazir + 1; | |
var todaysBlatt = start; | |
var blattRow = 5 + learnt; | |
var today = new Date().getTime(); | |
if(learnt !== 0){ | |
today = new Date(today + 86400000).getTime(); | |
} | |
for(start; start <= end; start++){ | |
var todaysBlattCell = activeSheet.getRange(blattRow, 2); | |
var dateCell = activeSheet.getRange(blattRow, 1); | |
var theDate = new Date(today); | |
var learntCell = activeSheet.getRange(blattRow,3).getValue(); | |
if(!learntCell){ | |
today = today + 86400000; | |
todaysBlattCell.setValue("Nazir " + start); | |
dateCell.setValue(theDate); | |
} | |
blattRow++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment