mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 12:21:35 +00:00
Added option oneitemperrow to 'gam print course-materials|course-work`
This commit is contained in:
@@ -3383,6 +3383,7 @@ gam print course-materials [todrive <ToDriveAttribute>*]
|
|||||||
(orderby <CourseMaterialOrderByFieldName> [ascending|descending])*)
|
(orderby <CourseMaterialOrderByFieldName> [ascending|descending])*)
|
||||||
[showcreatoremails|creatoremail] [showtopicnames] [fields <CourseMaterialFieldNameList>]
|
[showcreatoremails|creatoremail] [showtopicnames] [fields <CourseMaterialFieldNameList>]
|
||||||
[timefilter creationtime|updatetime|scheduledtime] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
[timefilter creationtime|updatetime|scheduledtime] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||||
|
[oneitemperrow]
|
||||||
[countsonly] [formatjson [quotechar <Character>]]
|
[countsonly] [formatjson [quotechar <Character>]]
|
||||||
gam print course-submissions [todrive <ToDriveAttribute>*]
|
gam print course-submissions [todrive <ToDriveAttribute>*]
|
||||||
(course|class <CourseEntity>)*|([teacher <UserItem>] [student <UserItem>] states <CourseStateList>])
|
(course|class <CourseEntity>)*|([teacher <UserItem>] [student <UserItem>] states <CourseStateList>])
|
||||||
@@ -3404,6 +3405,7 @@ gam print course-works [todrive <ToDriveAttribute>*]
|
|||||||
[showcreatoremails|creatoremail] [showtopicnames] [fields <CourseWorkFieldNameList>]
|
[showcreatoremails|creatoremail] [showtopicnames] [fields <CourseWorkFieldNameList>]
|
||||||
[showstudentsaslist [<Boolean>]] [delimiter <Character>]
|
[showstudentsaslist [<Boolean>]] [delimiter <Character>]
|
||||||
[timefilter creationtime|updatetime|scheduledtime] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
[timefilter creationtime|updatetime|scheduledtime] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||||
|
[oneitemperrow]
|
||||||
[countsonly] [formatjson [quotechar <Character>]]
|
[countsonly] [formatjson [quotechar <Character>]]
|
||||||
|
|
||||||
# Classroom - Student Groups
|
# Classroom - Student Groups
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
7.23.01
|
||||||
|
|
||||||
|
Added option `oneitemperrow` to 'gam print course-materials|course-work` to have each of a
|
||||||
|
course's materials displayed on a separate row with all of the other course fields.
|
||||||
|
This produces a CSV file that can be used in subsequent commands to process the materials without further script processing.
|
||||||
|
|
||||||
7.23.00
|
7.23.00
|
||||||
|
|
||||||
Added `chat_max_results` variable to `gam.cfg`.
|
Added `chat_max_results` variable to `gam.cfg`.
|
||||||
|
|||||||
@@ -49473,6 +49473,16 @@ def doPrintCourseWM(entityIDType, entityStateType):
|
|||||||
pass
|
pass
|
||||||
return topicNames
|
return topicNames
|
||||||
|
|
||||||
|
def _printCourseWMrow(course, courseWM):
|
||||||
|
row = flattenJSON(courseWM, flattened={'courseId': course['id'], 'courseName': course['name']}, timeObjects=TimeObjects,
|
||||||
|
simpleLists=['studentIds'] if showStudentsAsList else None, delimiter=delimiter)
|
||||||
|
if not FJQC.formatJSON:
|
||||||
|
csvPF.WriteRowTitles(row)
|
||||||
|
elif csvPF.CheckRowTitles(row):
|
||||||
|
csvPF.WriteRowNoFilter({'courseId': course['id'], 'courseName': course['name'],
|
||||||
|
'JSON': json.dumps(cleanJSON(courseWM, timeObjects=TimeObjects),
|
||||||
|
ensure_ascii=False, sort_keys=True)})
|
||||||
|
|
||||||
def _printCourseWM(course, courseWM, i, count):
|
def _printCourseWM(course, courseWM, i, count):
|
||||||
if applyCourseItemFilter and not _courseItemPassesFilter(courseWM, courseItemFilter):
|
if applyCourseItemFilter and not _courseItemPassesFilter(courseWM, courseItemFilter):
|
||||||
return
|
return
|
||||||
@@ -49484,14 +49494,13 @@ def doPrintCourseWM(entityIDType, entityStateType):
|
|||||||
topicId = courseWM.get('topicId')
|
topicId = courseWM.get('topicId')
|
||||||
if topicId:
|
if topicId:
|
||||||
courseWM['topicName'] = topicNames.get(topicId, topicId)
|
courseWM['topicName'] = topicNames.get(topicId, topicId)
|
||||||
row = flattenJSON(courseWM, flattened={'courseId': course['id'], 'courseName': course['name']}, timeObjects=TimeObjects,
|
if not oneItemPerRow or not courseWM.get('materials', []):
|
||||||
simpleLists=['studentIds'] if showStudentsAsList else None, delimiter=delimiter)
|
_printCourseWMrow(course, courseWM)
|
||||||
if not FJQC.formatJSON:
|
else:
|
||||||
csvPF.WriteRowTitles(row)
|
courseMaterials = courseWM.pop('materials')
|
||||||
elif csvPF.CheckRowTitles(row):
|
for courseMaterial in courseMaterials:
|
||||||
csvPF.WriteRowNoFilter({'courseId': course['id'], 'courseName': course['name'],
|
courseWM['materials'] = courseMaterial
|
||||||
'JSON': json.dumps(cleanJSON(courseWM, timeObjects=TimeObjects),
|
_printCourseWMrow(course, courseWM)
|
||||||
ensure_ascii=False, sort_keys=True)})
|
|
||||||
|
|
||||||
croom = buildGAPIObject(API.CLASSROOM)
|
croom = buildGAPIObject(API.CLASSROOM)
|
||||||
if entityIDType == Ent.COURSE_WORK_ID:
|
if entityIDType == Ent.COURSE_WORK_ID:
|
||||||
@@ -49529,7 +49538,7 @@ def doPrintCourseWM(entityIDType, entityStateType):
|
|||||||
courseShowProperties = _initCourseShowProperties(['name'])
|
courseShowProperties = _initCourseShowProperties(['name'])
|
||||||
OBY = OrderBy(OrderbyChoiceMap)
|
OBY = OrderBy(OrderbyChoiceMap)
|
||||||
creatorEmails = {}
|
creatorEmails = {}
|
||||||
showCreatorEmail = showTopicNames = False
|
oneItemPerRow = showCreatorEmail = showTopicNames = False
|
||||||
delimiter = GC.Values[GC.CSV_OUTPUT_FIELD_DELIMITER]
|
delimiter = GC.Values[GC.CSV_OUTPUT_FIELD_DELIMITER]
|
||||||
countsOnly = showStudentsAsList = False
|
countsOnly = showStudentsAsList = False
|
||||||
while Cmd.ArgumentsRemaining():
|
while Cmd.ArgumentsRemaining():
|
||||||
@@ -49546,6 +49555,9 @@ def doPrintCourseWM(entityIDType, entityStateType):
|
|||||||
pass
|
pass
|
||||||
elif myarg == 'orderby':
|
elif myarg == 'orderby':
|
||||||
OBY.GetChoice()
|
OBY.GetChoice()
|
||||||
|
elif myarg == 'oneitemperrow':
|
||||||
|
oneItemPerRow = True
|
||||||
|
csvPF.RemoveIndexedTitles('materials')
|
||||||
elif myarg in {'showcreatoremails', 'creatoremail'}:
|
elif myarg in {'showcreatoremails', 'creatoremail'}:
|
||||||
showCreatorEmail = True
|
showCreatorEmail = True
|
||||||
elif myarg == 'showtopicnames':
|
elif myarg == 'showtopicnames':
|
||||||
@@ -49626,6 +49638,7 @@ def doPrintCourseWM(entityIDType, entityStateType):
|
|||||||
# (orderby <CourseMaterialsOrderByFieldName> [ascending|descending])*)
|
# (orderby <CourseMaterialsOrderByFieldName> [ascending|descending])*)
|
||||||
# [showcreatoremails|creatoremail] [showtopicnames] [fields <CourseMaterialFieldNameList>]
|
# [showcreatoremails|creatoremail] [showtopicnames] [fields <CourseMaterialFieldNameList>]
|
||||||
# [timefilter creationtime|updatetime|scheduledtime] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
# [timefilter creationtime|updatetime|scheduledtime] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||||
|
# [oneitemperrow]
|
||||||
# [countsonly] [formatjson [quotechar <Character>]]
|
# [countsonly] [formatjson [quotechar <Character>]]
|
||||||
def doPrintCourseMaterials():
|
def doPrintCourseMaterials():
|
||||||
doPrintCourseWM(Ent.COURSE_MATERIAL_ID, Ent.COURSE_MATERIAL_STATE)
|
doPrintCourseWM(Ent.COURSE_MATERIAL_ID, Ent.COURSE_MATERIAL_STATE)
|
||||||
@@ -49637,6 +49650,7 @@ def doPrintCourseMaterials():
|
|||||||
# [showcreatoremails|creatoremail] [showtopicnames] [fields <CourseWorkFieldNameList>]
|
# [showcreatoremails|creatoremail] [showtopicnames] [fields <CourseWorkFieldNameList>]
|
||||||
# [showstudentsaslist [<Boolean>]] [delimiter <Character>]
|
# [showstudentsaslist [<Boolean>]] [delimiter <Character>]
|
||||||
# [timefilter creationtime|updatetime] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
# [timefilter creationtime|updatetime] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||||
|
# [oneitemperrow]
|
||||||
# [countsonly] [formatjson [quotechar <Character>]]
|
# [countsonly] [formatjson [quotechar <Character>]]
|
||||||
def doPrintCourseWork():
|
def doPrintCourseWork():
|
||||||
doPrintCourseWM(Ent.COURSE_WORK_ID, Ent.COURSE_WORK_STATE)
|
doPrintCourseWM(Ent.COURSE_WORK_ID, Ent.COURSE_WORK_STATE)
|
||||||
|
|||||||
Reference in New Issue
Block a user