A list of puns related to "Dynamic Passing Loop"
I'm working on a bug tracking app to strengthen my Node knowledge.
I'm using EJS to dynamically render from data from a database, and storing it in a table.
What I want to do is have the case number column to be a "link" that once clicked will take me to a page where users can add comments, send emails etc, basically a page dedicated to one individual case.
To do so, I believe the best thing to do is to pass the case number to the route as a request parameter, using a form.
It works, but when I click on each case number "button", the request query comes back as: localhost:3000/view-case/?case=7&case=8&case=9&case=23&case=24
I'm pretty sure that this is down to the fact that the input/buttons being in a forEach call..
I've checked my Network tab, and confirm that only one request is made, I've moved the form itself in and out of the forEach call and that has no effect on how this works.
Question, whats the best way to resolve such an issue, and can any one explain this behaviour?
My best guess is its because all the hidden inputs have the same name and value, so they are concatanating? If so, how can I go about fixing that?
I hope this makes sense, thanks in advance.
Formatting here is difficult, so please see my github here: https://github.com/UrgellMossley/bugTracker/blob/main/views/users/my-queue.ejs
(main repo is here: https://github.com/UrgellMossley/bugTracker)
<section class="ticket-table flex-container flex-centre">
<form action="/view-case/?" method="GET" id="case-form"></form>
<% if (cases.length === 0 ) {%>
<h1 class="headline text-sm" id="ticket-text">Let's get started!</h1>
<button class="btn-sm" id="display-form">Create New Case</button>
<%} else{ %>
<h1 class="headline text-lg" id="ticket-text">Your Tickets</h1>
<table class="text-xs">
<thead class="table-header">
<td class="head-column font-wt-700 case-header">Case Number</td>
<td class="head-column font-wt-700 priority- header">Priority</td>
<td class="head-column font-wt-700 last-Actioned-header">Last
Act
... keep reading on reddit β‘I created a function called lookpoint, which reads in a dynamic variable, interim1, interim2, or interim3.
When I run the function on its own, it works fine. When I read the function into a for loop, the variable names are created but no observations are generated.
Can someone kindly point me in the right direction? I've been struggling with this issue, but I can't seem to go further than generating the variable names. Thank you.
(I edited the original question to include reproducible example with comments to show what I am doing. Thanks!)
rm(list = ls())
cat("\014")
numlook <- 3 #num of look points
n<- 100 #number of observations
#Generate time-to-event data with censored variable
my_function <- function(){
time_init <- rep(NA, n) #initial time
time_cens <- rep(NA, n) #censoring time
time <- rep(NA, n)
time_init <- runif(n)*100
time_cens <- runif(n)*100
time <- pmin(time_init, time_cens) #take the minimum of the two for actual time
return(data.frame(time_init, time_cens, time))
}
output <- my_function()
output$event <- ifelse(output$time == output$time_init, event<-1, event<-0) #determine if event or censored
output$interim1 <- 25 #define interim cutpoints
output$interim2 <- 50
output$interim3 <- 75
lookpoint <- function(interim){
interim <- deparse(substitute(interim)) #needed for the [[]] part
L_evt <- ifelse(output$time < output[[interim]], 1, 0) #find event/censored at each interim
Y <- ifelse(output$time < output[[interim]], output$time, output[[interim]]) #Find time at each interim point
return(data.frame(L_evt, Y))
}
#Obtaining results using a serial approach
#interim1 <- lookpoint(interim1)
#interim2 <- lookpoint(interim2)
#interim3 <- lookpoint(interim3)
lookpoint_list <- noquote(paste0("interim",1:numlook)) #capture interim as a variable
#Where I am having trouble
for (i in 1:numlook){
assign(paste0("interim", i), lookpoint(noquote(paste0("interim", i))))
#assign(noquote(paste0("interim", i)), lookpoint(noquote(lookpoint_list[i])))
}
#Id like to merge these results (L_evt1, Y1, L_evt2, Y2, L_evt3, Y3) back with the original table, output.
I've got a page for a service catalog with an <input> that I want to fill with the name of a user when the page is arrived at from a certain button. The other purposes and details of the button aren't important, only that with its associated client script I can grab the id of the user and append it to the URL (and I don't quite get how sysparm_id, sysparm_view, et al work) that the user is sent to, but I don't know how to take that from the URL after I'm there and pre-fill it into the value of the <input> so the user doesn't have to. How do I do this?
I have a client side application that I would like to have the ability to specify arbitrary queries to MongoDB through a server side call to a query function.
I have tried multiple arrangements on both my client and server to try to make this work but I can't seem to figure out the correct way to go about this.
This is an example request that my client would send (although the goal is for the query property to be any valid query that one could hardcode on the server side):
{ "collectionName": "abilities", "query": "{\"_id\":{\"$in\":[5,{\"$oid\":\"619f97d1d977f089ac559368\"}]}}" }
On the server side, I've parsed the query with EJSON to try and get it to a state where I can pass it into the db.collection.find() method but the return type is not compatible (I receive: EJSON.SerilizbleType vs I need: Filter<Document>)
Another thought I had was to stringify the EJSON result and then convert it to JSON through JSON.parse(). If I console.log() the result, I get the following:
{ _id: { '$in': [ 5, '619f97d1d977f089ac559368' ] } }
Passing that into the find()
method produces no results.
If I console.log() the parsed text, I receive the following:
{ _id: { '$in': [ new Int32(5), new ObjectId("619f97d1d977f089ac559368") ] } }
Which shows that the JSON conversion is losing the type, which is important when constructing the query.
Thoughts on how I may go about this?
Hello. I have a Lian Li O11D Dynamic, and I am trying to work out the best loop to build, and whether it will fit. I have a 5950x, and 2 x 3080ti's. I have 2 EK SE360's and my old XSPC RX360 and RX240. I was initially thinking all 3 of the 360's (2 are 27mm) but then I have been told the SE360's are pretty bad. Then I considered selling the EK's and buying a 60mm 360, like the Corsair XR7, bit I am not sure if i can fit everything with 2 x GPUS.
I think a 60mm will fit the top, but will a 40mm fit on the bottom with 2 gpus? Or the vertical slot? Sorry for all the questions, just unsure of mounting sizes and requirements to keep those 3 components cooled. Running them with 1850rpm Scythe gentle typhoons
Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.