<commit_before>package edu.umdearborn.astronomyapp.controller;

import static edu.umdearborn.astronomyapp.util.constants.UrlConstants.REST_PATH_PREFIX;
import static edu.umdearborn.astronomyapp.util.constants.UrlConstants.STUDENT_PATH;
import static org.springframework.web.bind.annotation.RequestMethod.GET;

import java.security.Principal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.SessionAttributes;

import edu.umdearborn.astronomyapp.service.AclService;

@RestController
@RequestMapping(REST_PATH_PREFIX + STUDENT_PATH)
@SessionAttributes("checkin")
public class ModuleLockController {
  
  private static final Logger logger = LoggerFactory.getLogger(ModuleLockController.class);
  
  private AclService acl;

  public ModuleLockController(AclService acl) {
    this.acl = acl;
  }

  @ModelAttribute("checkin")
  public Map<String, List<String>> createCheckin() {
    return new HashMap<String, List<String>>();
  }

  @RequestMapping(value = "/course/{courseId}/module/{moduleId}/checkin", method = GET)
  public List<String> getCheckinStatus(@PathVariable("courseId") String courseId,
      @PathVariable("moduleId") String moduleId,
      @ModelAttribute("checkin") Map<String, List<String>> checkin, Principal principal) {

    acl.enforceCourse(principal.getName(), courseId);

    List<String> checkinStatus =
        Optional.ofNullable(checkin.get(courseId + "/" + moduleId)).orElse(new ArrayList<String>());

    if (checkinStatus.isEmpty()) {
      checkinStatus.add(principal.getName().toLowerCase());
      logger.info("Creating new entry for {}/{} checkin", courseId, moduleId);
    }

    return checkinStatus;
  }
}<commit_msg>fixed checkin session variable<commit_after>package edu.umdearborn.astronomyapp.controller;

import static edu.umdearborn.astronomyapp.util.constants.UrlConstants.REST_PATH_PREFIX;
import static edu.umdearborn.astronomyapp.util.constants.UrlConstants.STUDENT_PATH;
import static org.springframework.web.bind.annotation.RequestMethod.GET;

import java.security.Principal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.SessionAttributes;

import edu.umdearborn.astronomyapp.service.AclService;

@RestController
@RequestMapping(REST_PATH_PREFIX + STUDENT_PATH)
@SessionAttributes("checkin")
public class ModuleLockController {

  private static final Logger logger = LoggerFactory.getLogger(ModuleLockController.class);

  private AclService acl;

  public ModuleLockController(AclService acl) {
    this.acl = acl;
  }

  @ModelAttribute("checkin")
  public Map<String, List<String>> createCheckin() {
    return new HashMap<String, List<String>>();
  }

  @RequestMapping(value = "/course/{courseId}/module/{moduleId}/checkin", method = GET)
  public List<String> getCheckinStatus(@PathVariable("courseId") String courseId,
      @PathVariable("moduleId") String moduleId,
      @ModelAttribute("checkin") Map<String, List<String>> checkin, Principal principal) {

    acl.enforceCourse(principal.getName(), courseId);

    List<String> checkinStatus =
        Optional.ofNullable(checkin.get(courseId + "/" + moduleId)).orElse(new ArrayList<String>());

    if (!checkinStatus.contains(principal.getName().toLowerCase())) {
      checkinStatus.add(principal.getName().toLowerCase());
      logger.info("Creating new entry for {}/{} checkin", courseId, moduleId);
    }

    checkin.put(courseId + "/" + moduleId, checkinStatus);

    return checkinStatus;
  }
}
{'fraction_non_alphanumeric': 0.1169467787114846, 'fraction_numerical': 0.0009337068160597573, 'mean_word_length': 5.769352290679305, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7062448', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1262, 'n_words': 218}