<commit_before><html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
</head>
<body>

<?php

include("connect.php");

#echo ("<p>Connected to database.</p>");
echo ("<p>Weather Station Readings</p>
<p>r - real readings</p>
<p>f - forecast data</p>");  


$query = "SELECT time, value, reading.locationID, sensorSpec.typeID, device.deviceType, location.comment
FROM reading
JOIN sensor USING (sensorID) 
JOIN device USING(deviceID)
JOIN location ON(reading.locationID= location.locationID)
JOIN sensorSpec USING (specID)
JOIN sensorType USING (typeID)
ORDER BY time DESC";    
$result = mysqli_query($connect, $query)  
or die (mysqli_error($connect));

$readings=array();
$lastReading=null;

 while($row=mysqli_fetch_array($result, MYSQLI_ASSOC)) 
{	
	if($lastReading != null)
	{
		if($lastReading["time"] == $row["time"] && $lastReading["deviceType"] == $row["deviceType"])
		{
			if($row[typeID] =='H')
			{
				$readings[sizeof($readings)-1]["humidity"] = $row["value"];
			}
			else
			{
				$readings[sizeof($readings)-1]["temperature"] = $row["value"]; 
			}
			continue;
		}
	} 	
	
	if($row[typeID] =='H')
	{	
		$row["humidity"]=$row["value"];
	}	
	else ##($row[typeID] =='T')
	{
		$row["temperature"] = $row["value"];
	}
	
	$lastReading=$row;
	$readings[]=$lastReading;
}

echo "<table class='table table-hover'>
<thead>
	<tr>
		<th>Time</th>
		<th>Location</th>
		<th>Temperature</th>
		<th>Humidity</th>
		<th>Type</th>
	</tr>
</thead>";

###time, value, reading.locationID, sensorSpec.typeID, device.deviceType, location.comment
for($i=0; $i < sizeof($readings); $i++) 
{ 
	$row=$readings[$i]; 

	$date=gmdate("Y-m-d\ | H:i:s\ ", $row["time"]);
	if($row["deviceType"] == 'r')
	{
	echo"<tr bgcolor='#6cc534'>
		<td> $date </td> 
		<td> $row[comment] </td>	
		<td> $row[temperature] &degC </td>
		<td> $row[humidity] % </td>		 
		<td> $row[deviceType] </td>
		</tr>";	
	}
	else
	{
		echo"<tr> 
		<td> $date </td> 
		<td> $row[comment] </td>	
		<td> $row[temperature] &degC </td>
		<td> $row[humidity] % </td>		 
		<td> $row[deviceType] </td>
		</tr>";	
	}
} 

echo "</table>";
?>
</body>
</html><commit_msg>update colors<commit_after><html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
</head>
<body>

<?php

include("connect.php");

#echo ("<p>Connected to database.</p>");
echo ("<p>Weather Station Readings</p>
<p>r - real readings</p>
<p>f - forecast data</p>");  


$query = "SELECT time, value, reading.locationID, sensorSpec.typeID, device.deviceType, location.comment
FROM reading
JOIN sensor USING (sensorID) 
JOIN device USING(deviceID)
JOIN location ON(reading.locationID= location.locationID)
JOIN sensorSpec USING (specID)
JOIN sensorType USING (typeID)
ORDER BY time DESC";    
$result = mysqli_query($connect, $query)  
or die (mysqli_error($connect));

$readings=array();
$lastReading=null;

 while($row=mysqli_fetch_array($result, MYSQLI_ASSOC)) 
{	
	if($lastReading != null)
	{
		if($lastReading["time"] == $row["time"] && $lastReading["deviceType"] == $row["deviceType"])
		{
			if($row[typeID] =='H')
			{
				$readings[sizeof($readings)-1]["humidity"] = $row["value"];
			}
			else
			{
				$readings[sizeof($readings)-1]["temperature"] = $row["value"]; 
			}
			continue;
		}
	} 	
	
	if($row[typeID] =='H')
	{	
		$row["humidity"]=$row["value"];
	}	
	else ##($row[typeID] =='T')
	{
		$row["temperature"] = $row["value"];
	}
	
	$lastReading=$row;
	$readings[]=$lastReading;
}

echo "<table class='table table-hover'>
<thead>
	<tr>
		<th>Time</th>
		<th>Location</th>
		<th>Temperature</th>
		<th>Humidity</th>
		<th>Type</th>
	</tr>
</thead>";

###time, value, reading.locationID, sensorSpec.typeID, device.deviceType, location.comment
for($i=0; $i < sizeof($readings); $i++) 
{ 
	$row=$readings[$i]; 

	$date=gmdate("Y-m-d\ | H:i:s\ ", $row["time"]);
	if($row["deviceType"] == 'r')
	{
	echo"<tr bgcolor='#6cc534'>
		<td> $date </td> 
		<td> $row[comment] </td>	
		<td> $row[temperature] &degC </td>
		<td> $row[humidity] % </td>		 
		<td> $row[deviceType] </td>
		</tr>";	
	}
	else
	{
		echo"<tr bgcolor='#eff67b'> 
		<td> $date </td> 
		<td> $row[comment] </td>	
		<td> $row[temperature] &degC </td>
		<td> $row[humidity] % </td>		 
		<td> $row[deviceType] </td>
		</tr>";	
	}
} 

echo "</table>";
?>
</body>
</html>
{'fraction_non_alphanumeric': 0.23060618906316235, 'fraction_numerical': 0.005934718100890208, 'mean_word_length': 4.344280860702152, 'pattern_counts': {'":': 0, '<': 123, '<?xml version=': 0, '>': 121, 'https://': 4, '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': '5024436', 'n_tokens_mistral': 2063, 'n_tokens_neox': 1890, 'n_words': 343}