deepsource-autofix-76c6eb20
Dan Gowans 2022-08-30 14:47:31 -04:00
parent e0761624bc
commit 4ab29dd5df
5 changed files with 57 additions and 45 deletions

View File

@ -1,16 +1,20 @@
import type { RequestHandler } from "express"; import type {
RequestHandler
} from "express";
import { addMap } from "../../helpers/lotOccupancyDB/addMap.js"; import {
addMap
} from "../../helpers/lotOccupancyDB/addMap.js";
export const handler: RequestHandler = async (request, response) => { export const handler: RequestHandler = async (request, response) => {
const mapId = addMap(request.body, request.session); const mapId = addMap(request.body, request.session);
response.json({ response.json({
success: true, success: true,
mapId mapId
}); });
}; };

View File

@ -1,16 +1,20 @@
import type { RequestHandler } from "express"; import type {
RequestHandler
} from "express";
import { updateMap } from "../../helpers/lotOccupancyDB/updateMap.js"; import {
updateMap
} from "../../helpers/lotOccupancyDB/updateMap.js";
export const handler: RequestHandler = async (request, response) => { export const handler: RequestHandler = async (request, response) => {
const success = updateMap(request.body, request.session); const success = updateMap(request.body, request.session);
response.json({ response.json({
success, success,
mapId: request.body.mapId mapId: request.body.mapId
}); });
}; };

View File

@ -288,35 +288,35 @@
<% for (const lotOccupancy of lot.lotOccupancies) { %> <% for (const lotOccupancy of lot.lotOccupancies) { %>
<% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %> <% const isActive = !(lotOccupancy.occupancyEndDate && lotOccupancy.occupancyEndDate < currentDate); %>
<tr> <tr>
<td class="has-text-centered"> <td class="has-text-centered">
<% if (isActive) { %> <% if (isActive) { %>
<i class="fas fa-play" title="Current <%= configFunctions.getProperty("aliases.occupancy") %>"></i> <i class="fas fa-play" title="Current <%= configFunctions.getProperty("aliases.occupancy") %>"></i>
<% } else { %> <% } else { %>
<i class="fas fa-stop" title="Previous <%= configFunctions.getProperty("aliases.occupancy") %>"></i> <i class="fas fa-stop" title="Previous <%= configFunctions.getProperty("aliases.occupancy") %>"></i>
<% } %> <% } %>
</td> </td>
<td> <td>
<a class="has-text-weight-bold" href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>"> <a class="has-text-weight-bold" href="<%= urlPrefix %>/lotOccupancies/<%= lotOccupancy.lotOccupancyId %>">
<%= lotOccupancy.occupancyType %> <%= lotOccupancy.occupancyType %>
</a> </a>
</td> </td>
<td><%= lotOccupancy.occupancyStartDateString %></td> <td><%= lotOccupancy.occupancyStartDateString %></td>
<td> <td>
<% if (lotOccupancy.occupancyEndDate) { %> <% if (lotOccupancy.occupancyEndDate) { %>
<%= lotOccupancy.occupancyEndDateString %> <%= lotOccupancy.occupancyEndDateString %>
<% } else { %> <% } else { %>
(No End Date) <span class="has-text-grey">(No End Date)</span>
<% } %> <% } %>
</td> </td>
<td> <td>
<% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %> <% if (lotOccupancy.lotOccupancyOccupants.length === 0) { %>
(No <%= configFunctions.getProperty("aliases.occupants") %>) <span class="has-text-grey">(No <%= configFunctions.getProperty("aliases.occupants") %>)</span>
<% } else { %> <% } else { %>
<% const occupant = lotOccupancy.lotOccupancyOccupants[0]; %> <% const occupant = lotOccupancy.lotOccupancyOccupants[0]; %>
<%= occupant.occupantName %> <%= occupant.occupantName %>
<%= (lotOccupancy.lotOccupancyOccupants.length > 1 ? " plus " + (lotOccupancy.lotOccupancyOccupants.length - 1) : "") %> <%= (lotOccupancy.lotOccupancyOccupants.length > 1 ? " plus " + (lotOccupancy.lotOccupancyOccupants.length - 1) : "") %>
<% } %> <% } %>
</td> </td>
</tr> </tr>
<% } %> <% } %>
</tbody> </tbody>

View File

@ -212,7 +212,7 @@
</a> </a>
</div> </div>
</div> </div>
</div> </div>
<% } %> <% } %>
</div> </div>
</div> </div>

View File

@ -86,7 +86,11 @@
</p> </p>
<p> <p>
<strong>End Date</strong><br /> <strong>End Date</strong><br />
<span class="has-text-grey"><%= (lotOccupancy.occupancyEndDateString === "" ? "(No End Date)" : lotOccupancy.occupancyEndDateString) %></span> <% if (lotOccupancy.occupancyEndDateString === "") { %>
<span class="has-text-grey">(No End Date)</span>
<% } else { %>
<%= lotOccupancy.occupancyEndDateString %>
<% } %>
</p> </p>
</div> </div>
<% if (lotOccupancy.lotOccupancyFields.length > 0) { %> <% if (lotOccupancy.lotOccupancyFields.length > 0) { %>