<commit_before>

<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>

    </head>
    <body>
	<form action = "weekview.php" method = "POST">
        <h2>Enter name of subgroup: </h2>
        <select name="monthSelect">
            <option></option>

			<?php 
			include ('database.php');
			 $datearray = array();
			    foreach($connection->query("SELECT YEAR(dateName) AS 'year', MONTH(dateName) AS 'month' FROM tblDATE") as $row) {
			 if ($row['year'] != '0' && strlen($row['year']) > 0) { 

			 	$datearray[$row['year'].$row['month']] = $row['year'] . ' ' . $row['month'];
			}
			}
			foreach ($datearray as $value) {

			 	?>
			        <option>
			            <span>
			                <?php 
			                	echo  $value;
			                ?>
			            </span>
			            </br>
			        </option>
			 
			    <?php }

				?>

		 </select>
	        

	 	<select name="weekSelect">
		 	 <option></option> </br>
		     <option>1</option> </br>
		      <option>2</option> </br>
		      <option>3</option> </br>
		      <option>4</option> </br>

	    </select>



	    </br><input name = "formSubmit" type="submit" value="Select View">
	 </form>


       <?php  
include ('database.php');

if(isset($_POST['formSubmit'])) 
{

$monthyear = $_POST['monthSelect'];
$pieces = explode(" ", $monthyear);
$year = $pieces[0];
$month = $pieces[1];
$nextmonth = $month+1;
$week = $_POST['weekSelect'];



foreach($connection->query("Select StartTime, EndTime, PracticeTypeName, DateName, PlayerName
from tblPRACTICE p
join tblPRACTICE_TYPE pt
on p.PracticeTypeID = pt.PracticeTypeID
join tblDATE d
on p.DateID = d.DateID
join tblPLAYER_PRACTICE pp
on pp.PracticeID = p.PracticeID
join tblPLAYER pl
on pp.PlayerID = pl.PlayerID
WHERE DATE(d.DateName) BETWEEN '$year-$month-01' AND '$year-$nextmonth-01'") as $row) {
	echo $row['DateName'] . ' ' . $row['PlayerName']. ' ' . $row['StartTime'] . ' to ' . $row['EndTime'];
	echo '</br>';
}

}

/* foreach($connection->query("Select StartTime, EndTime, PracticeTypeName, DateName, PlayerName
from tblPRACTICE p
join tblPRACTICE_TYPE pt
on p.PracticeTypeID = pt.PracticeTypeID
join tblDATE d
on p.DateID = d.DateID
join tblPLAYER_PRACTICE pp
on pp.PracticeID = p.PracticeID
join tblPLAYER pl
on pp.PlayerID = pl.PlayerID") as $row) {
	echo $row['DateName'] . ' ' . $row['PlayerName']. ' ' . $row['StartTime'] . ' to ' . $row['EndTime'];
	echo '</br>';
 } */

?>
    </body>
</html><commit_msg>filters by week<commit_after>

<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>

    </head>
    <body>
	<form action = "weekview.php" method = "POST">
        <h2>Enter name of subgroup: </h2>
        <select name="monthSelect">
            <option></option>

			<?php 
			include ('database.php');
			 $datearray = array();
			    foreach($connection->query("SELECT YEAR(dateName) AS 'year', MONTH(dateName) AS 'month' FROM tblDATE") as $row) {
			 if ($row['year'] != '0' && strlen($row['year']) > 0) { 

			 	$datearray[$row['year'].$row['month']] = $row['year'] . ' ' . $row['month'];
			}
			}
			foreach ($datearray as $value) {

			 	?>
			        <option>
			            <span>
			                <?php 
			                	echo  $value;
			                ?>
			            </span>
			            </br>
			        </option>
			 
			    <?php }

				?>

		 </select>
	        

	 	<select name="weekSelect">
		 	 <option></option> </br>
		     <option>1</option> </br>
		      <option>2</option> </br>
		      <option>3</option> </br>
		      <option>4</option> </br>

	    </select>



	    </br><input name = "formSubmit" type="submit" value="Select View">
	 </form>


       <?php  
include ('database.php');

if(isset($_POST['formSubmit'])) 
{

$monthyear = $_POST['monthSelect'];
$pieces = explode(" ", $monthyear);
$year = $pieces[0];
$month = $pieces[1];
$nextmonth = $month+1;
$week = $_POST['weekSelect'];

if ($week == 1) {
	$week = '01';
} else if ($week == 2) {
	$week = '08';
} else if ($week == 3){
	$week = '15';
} else {
	$week = '22';
}

$num_length = strlen((string)$month);
if($num_length < 2) {
    // Pass
    $month = '0'.$month;
} 


$date = $year.$month.$week;
echo $date . '</br>';

$weekrange = week_range($date);
$startday = $weekrange[0];
$endday = $weekrange[1];

foreach($connection->query("Select StartTime, EndTime, PracticeTypeName, DateName, PlayerName
from tblPRACTICE p
join tblPRACTICE_TYPE pt
on p.PracticeTypeID = pt.PracticeTypeID
join tblDATE d
on p.DateID = d.DateID
join tblPLAYER_PRACTICE pp
on pp.PracticeID = p.PracticeID
join tblPLAYER pl
on pp.PlayerID = pl.PlayerID
WHERE DATE(d.DateName) BETWEEN '$startday' AND '$endday'") as $row) {
	echo $row['DateName'] . ' ' . $row['PlayerName']. ' ' . $row['StartTime'] . ' to ' . $row['EndTime'];
	echo '</br>';
}

}

?>
    </body>
</html>



<?php 
function week_range($date) {
  $ts = strtotime($date);
  $start = (date('w', $ts) == 0) ? $ts : strtotime('last sunday', $ts);
  return array(date('Y.m.d', $start), 
  	date('Y.m.d', strtotime('next saturday', $start)));
}



?>

{'fraction_non_alphanumeric': 0.19691647150663544, 'fraction_numerical': 0.00858704137392662, 'mean_word_length': 2.652886671418389, 'pattern_counts': {'":': 0, '<': 101, '<?xml version=': 0, '>': 107, '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': '2676558', 'n_tokens_mistral': 2045, 'n_tokens_neox': 1790, 'n_words': 402}