bug fixes

-- subadmin can score any entry
This commit is contained in:
sairaj mote 2022-12-06 20:44:16 +05:30
parent 1a072b939e
commit 3b614f39b7

View File

@ -1260,7 +1260,7 @@
function renderSheetView(details = {}) { function renderSheetView(details = {}) {
const { sheetId, title, description, editors, attributes, sheet, onlyRenderTable = false, lazyLoad = false } = details const { sheetId, title, description, editors, attributes, sheet, onlyRenderTable = false, lazyLoad = false } = details
const isWriteable = !editors || editors.includes(myFloID) const isWriteable = !editors || editors.includes(myFloID) || floGlobals.isSubAdmin
if (!lazyLoad) if (!lazyLoad)
floGlobals.currentSheet = { sheetId, title, description, editors, attributes, sheet, } floGlobals.currentSheet = { sheetId, title, description, editors, attributes, sheet, }
if (lazyLoad) { if (lazyLoad) {
@ -1279,7 +1279,7 @@
let addLogRow = null let addLogRow = null
//Add input fields if writable //Add input fields if writable
if (isWriteable && !lazyLoad) { if (isWriteable && !lazyLoad) {
const blockEditingID = editors ? false: !floGlobals.isSubAdmin; const blockEditingID = editors ? false : !floGlobals.isSubAdmin;
addLogRow = html` addLogRow = html`
<tr> <tr>
<td>${html`<input form="new-log" class="log-input" style="width: 22rem" value=${blockEditingID ? myFloID : ''} ?readonly=${blockEditingID}>`}</td> <td>${html`<input form="new-log" class="log-input" style="width: 22rem" value=${blockEditingID ? myFloID : ''} ?readonly=${blockEditingID}>`}</td>
@ -1307,8 +1307,8 @@
let time = getFormattedTime(parseInt(vectorClock)); let time = getFormattedTime(parseInt(vectorClock));
return `by ${floID} (${time})` return `by ${floID} (${time})`
} }
const createGradeField = (vc, grade) => { const createGradeField = (grade) => {
const isDisabled = (!isWriteable || !floGlobals.isSubAdmin || vc.split('_')[1] == myFloID) const isDisabled = (!isWriteable || !floGlobals.isSubAdmin)
return html`<input type="number" class="grade-input" min="0" max="100" value=${grade} ?disabled=${isDisabled}>` return html`<input type="number" class="grade-input" min="0" max="100" value=${grade} ?disabled=${isDisabled}>`
} }
for (let i = startingIndex; i < endingIndex; i++) { for (let i = startingIndex; i < endingIndex; i++) {
@ -1318,7 +1318,7 @@
frag.append(html.node` frag.append(html.node`
<tr title="${parseVectorClock(vc)}" .dataset=${{ vc }}> <tr title="${parseVectorClock(vc)}" .dataset=${{ vc }}>
<td>${floID}</td> <td>${floID}</td>
<td>${createGradeField(vc, grade)}</td> <td>${createGradeField(grade)}</td>
${log.map(l => html`<td>${l}</td>`)} ${log.map(l => html`<td>${l}</td>`)}
</tr> </tr>
`) `)