Skip to content

Commit

Permalink
Merge pull request #1027 from ubc/plan-release-date-coursename
Browse files Browse the repository at this point in the history
UPDATE Plan release date for text and filter to remove deleted assignments
  • Loading branch information
ubc-tuehoang authored Jun 23, 2022
2 parents fb407c1 + e3b49c0 commit e83c50f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compair/api/assignment_search_enddate.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def get(self):
db_url = str(current_app.config['SQLALCHEMY_DATABASE_URI'])
engine = create_engine(db_url, pool_size=5, pool_recycle=3600)
conn = engine.connect()
sql_text = str("SELECT JSON_OBJECT('course_name', t1.name,'name', t2.name,'answer_start', date_format(t2.answer_start, '%%M %%d, %%Y'),'answer_end', date_format(t2.answer_end, '%%M %%d, %%Y'),'compare_start', date_format(t2.compare_start, '%%M %%d, %%Y'), 'compare_end', date_format(t2.compare_end, '%%M %%d, %%Y')) FROM course as t1, assignment as t2 WHERE (t1.id = t2.course_id) AND (t2.compare_end >= '" + end_date + "' OR answer_end >= '" + end_date + "');");
##print(sql_text)

sql_text = str("SELECT JSON_OBJECT('course_name', t1.name,'name', t2.name,'answer_start', date_format(t2.answer_start, '%%M %%d, %%Y'),'answer_end', date_format(t2.answer_end, '%%M %%d, %%Y'),'compare_start', date_format(t2.compare_start, '%%M %%d, %%Y'), 'compare_end', date_format(t2.compare_end, '%%M %%d, %%Y')) FROM course as t1, assignment as t2 WHERE (t1.id = t2.course_id) AND (t2.active=1) AND (t2.compare_end >= '" + end_date + "' OR answer_end >= '" + end_date + "');");
result = conn.execute(sql_text)

final_result = [list(i) for i in result]
Expand Down
9 changes: 9 additions & 0 deletions compair/static/script-assignment-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ function showsearchapi(search_data) {
for (let key in search_data) {
//tab += `<tr><td colspan="4">${search_data[key]}</td></tr>`;
let obj = JSON.parse(search_data[key])

if (obj.compare_start == null){
obj.compare_start = 'After answering ends';
}

if (obj.compare_end == null){
obj.compare_end = '<i>No end date</i>';
}

tab += `<tr><td>${JSON.stringify(obj.course_name).replace(/\"/g, "")}</td><td>${JSON.stringify(obj.name).replace(/\"/g, "")}</td><td>${JSON.stringify(obj.answer_start).replace(/\"/g, "")}</td><td>${JSON.stringify(obj.answer_end).replace(/\"/g, "")}</td><td>${JSON.stringify(obj.compare_start).replace(/\"/g, "")}</td><td>${JSON.stringify(obj.compare_end).replace(/\"/g, "")}</td></tr>`;
iKey++;
}
Expand Down

0 comments on commit e83c50f

Please sign in to comment.