mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-03 22:01:39 +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])*)
|
||||
[showcreatoremails|creatoremail] [showtopicnames] [fields <CourseMaterialFieldNameList>]
|
||||
[timefilter creationtime|updatetime|scheduledtime] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||
[oneitemperrow]
|
||||
[countsonly] [formatjson [quotechar <Character>]]
|
||||
gam print course-submissions [todrive <ToDriveAttribute>*]
|
||||
(course|class <CourseEntity>)*|([teacher <UserItem>] [student <UserItem>] states <CourseStateList>])
|
||||
@@ -3404,6 +3405,7 @@ gam print course-works [todrive <ToDriveAttribute>*]
|
||||
[showcreatoremails|creatoremail] [showtopicnames] [fields <CourseWorkFieldNameList>]
|
||||
[showstudentsaslist [<Boolean>]] [delimiter <Character>]
|
||||
[timefilter creationtime|updatetime|scheduledtime] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||
[oneitemperrow]
|
||||
[countsonly] [formatjson [quotechar <Character>]]
|
||||
|
||||
# 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
|
||||
|
||||
Added `chat_max_results` variable to `gam.cfg`.
|
||||
|
||||
@@ -49473,6 +49473,16 @@ def doPrintCourseWM(entityIDType, entityStateType):
|
||||
pass
|
||||
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):
|
||||
if applyCourseItemFilter and not _courseItemPassesFilter(courseWM, courseItemFilter):
|
||||
return
|
||||
@@ -49484,14 +49494,13 @@ def doPrintCourseWM(entityIDType, entityStateType):
|
||||
topicId = courseWM.get('topicId')
|
||||
if topicId:
|
||||
courseWM['topicName'] = topicNames.get(topicId, topicId)
|
||||
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)})
|
||||
if not oneItemPerRow or not courseWM.get('materials', []):
|
||||
_printCourseWMrow(course, courseWM)
|
||||
else:
|
||||
courseMaterials = courseWM.pop('materials')
|
||||
for courseMaterial in courseMaterials:
|
||||
courseWM['materials'] = courseMaterial
|
||||
_printCourseWMrow(course, courseWM)
|
||||
|
||||
croom = buildGAPIObject(API.CLASSROOM)
|
||||
if entityIDType == Ent.COURSE_WORK_ID:
|
||||
@@ -49529,7 +49538,7 @@ def doPrintCourseWM(entityIDType, entityStateType):
|
||||
courseShowProperties = _initCourseShowProperties(['name'])
|
||||
OBY = OrderBy(OrderbyChoiceMap)
|
||||
creatorEmails = {}
|
||||
showCreatorEmail = showTopicNames = False
|
||||
oneItemPerRow = showCreatorEmail = showTopicNames = False
|
||||
delimiter = GC.Values[GC.CSV_OUTPUT_FIELD_DELIMITER]
|
||||
countsOnly = showStudentsAsList = False
|
||||
while Cmd.ArgumentsRemaining():
|
||||
@@ -49546,6 +49555,9 @@ def doPrintCourseWM(entityIDType, entityStateType):
|
||||
pass
|
||||
elif myarg == 'orderby':
|
||||
OBY.GetChoice()
|
||||
elif myarg == 'oneitemperrow':
|
||||
oneItemPerRow = True
|
||||
csvPF.RemoveIndexedTitles('materials')
|
||||
elif myarg in {'showcreatoremails', 'creatoremail'}:
|
||||
showCreatorEmail = True
|
||||
elif myarg == 'showtopicnames':
|
||||
@@ -49626,6 +49638,7 @@ def doPrintCourseWM(entityIDType, entityStateType):
|
||||
# (orderby <CourseMaterialsOrderByFieldName> [ascending|descending])*)
|
||||
# [showcreatoremails|creatoremail] [showtopicnames] [fields <CourseMaterialFieldNameList>]
|
||||
# [timefilter creationtime|updatetime|scheduledtime] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||
# [oneitemperrow]
|
||||
# [countsonly] [formatjson [quotechar <Character>]]
|
||||
def doPrintCourseMaterials():
|
||||
doPrintCourseWM(Ent.COURSE_MATERIAL_ID, Ent.COURSE_MATERIAL_STATE)
|
||||
@@ -49637,6 +49650,7 @@ def doPrintCourseMaterials():
|
||||
# [showcreatoremails|creatoremail] [showtopicnames] [fields <CourseWorkFieldNameList>]
|
||||
# [showstudentsaslist [<Boolean>]] [delimiter <Character>]
|
||||
# [timefilter creationtime|updatetime] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||
# [oneitemperrow]
|
||||
# [countsonly] [formatjson [quotechar <Character>]]
|
||||
def doPrintCourseWork():
|
||||
doPrintCourseWM(Ent.COURSE_WORK_ID, Ent.COURSE_WORK_STATE)
|
||||
|
||||
Reference in New Issue
Block a user