Skip to content

Commit

Permalink
Fix ta_judge column index for openpyxl
Browse files Browse the repository at this point in the history
Because cell.column is str and causes bug, we turn to use cell.col_idx
to make sure the column is integer.
  • Loading branch information
aben20807 committed Apr 26, 2022
1 parent 9095fd4 commit 6a36862
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions local_judge/ta_judge.py
Expand Up @@ -361,16 +361,16 @@ def main():
for row in sheet.rows:
if row[1].value == this_student_id:
for cell in row:
if sheet.cell(row=1, column=cell.column).value in [
if sheet.cell(row=1, column=cell.col_idx).value in [
"name",
"student_id",
"in_log",
"log_msg",
]:
continue
if cell.column - 3 >= len(result):
if cell.col_idx - 3 >= len(result):
break
cell.value = result[cell.column - 3]
cell.value = result[cell.col_idx - 3]
break
book.save(ta_config["TaConfig"]["ScoreOutput"])

Expand Down
2 changes: 1 addition & 1 deletion local_judge/version.py
Expand Up @@ -22,4 +22,4 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
__version__ = "2.7.1"
__version__ = "2.7.2"

0 comments on commit 6a36862

Please sign in to comment.