Skip to content

Commit

Permalink
replaced npm install with npm ci in docker file + added comments in t…
Browse files Browse the repository at this point in the history
…odos.js
  • Loading branch information
if22b088 committed Aug 26, 2024
1 parent cbeea49 commit da877df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WORKDIR /app
COPY package*.json ./

# Install the application dependencies
RUN npm install
RUN npm ci

# Copy the rest of the application code to the working directory
COPY . .
Expand Down
5 changes: 5 additions & 0 deletions routes/todos.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ var router = express.Router();
// Helper function to extract distinctId from cookies
function getDistinctIdFromCookies(req) {
try {
console.log ("inside getDistinctIdFromCookies function")
let cookies = req.cookies['ph_phc_xC1fBU65c02AaFCisiKximyPseHTHIUGSRwtQayUXs0_posthog'];
if (cookies) {
console.log ("inside if statement in getDistinctIdFromCookies function")
const distinctId = JSON.parse(cookies)['distinct_id'];
return distinctId;
}
Expand All @@ -87,10 +89,13 @@ function getDistinctIdFromCookies(req) {

// Helper function to handle todos sorting and date updating
async function processTodos(todos, distinctId) {
console.log ("inside processTodos function")
const isFeatureEnabled = await posthog.isFeatureEnabled('move-unfinished-todos', distinctId);

if (isFeatureEnabled) {
// Sort and update todos based on the feature flag
console.log ("inside if statement processTodos function")

return todos
.sort((a, b) => {
if (!a.done && b.done) return 1;
Expand Down

0 comments on commit da877df

Please sign in to comment.